title: Intellij Idea: Importing Gradle project - getting JAVA_HOME not defined yet
body: <p>Intellij Idea 14.1.4
  Mac OS X Yosemite 10.10.3 and later.</p>
  
  <p>From the IDE:</p>
  
  <pre><code>Import Project -&gt;
  (Chosen directory to import) -&gt;
  Import project from external model, Gradle -&gt;
  Gradle Home: /usr/local/Cellar/gradle/2.4/libexec
  Gradle JVM: Use JAVA_HOME (not defined yet)
  </code></pre>
  
  <p>From shell:</p>
  
  <pre><code>echo $JAVA_HOME
  
  /Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home
  </code></pre>
  
  <p>(defined in .profile: export JAVA_HOME="$(/usr/libexec/java_home -v 1.8)"</p>
  
  <p>What am I missing. I have checked other discussions in SO, for example, <a href="https://stackoverflow.com/questions/30960103/intellij-java-home-variable">Intellij JAVA_HOME variable</a>, but don't have Project SDK prompt. </p>
  
  <p><img src="https://i.stack.imgur.com/Dt6zH.png" alt=""></p>