title: gradle doesn't work in Intellij - problems with JAVA_HOME
body: <ul>
  <li>I can run gradle from a command line to see its version.</li>
  <li>I can run, compile and debug a grails app in IntelliJ (version 10.0 or version 10.2)</li>
  <li>I installed the IntelliJ Gradle Plugin.</li>
  </ul>
  
  <p>Whenever I try to do anything with gradle from within Intellij I get an error as follows:</p>
  
  <pre><code>Executing command: "tasks"
  Failed to connect to gradle process for command 'tasks'
  
  ERROR: JAVA_HOME is set to an invalid directory: C:\Program Files (x86)\JetBrains\IntelliJ IDEA 10.0\jre
  
  Please set the JAVA_HOME variable in your environment to match the
  location of your Java installation.
  </code></pre>
  
  <p>But in my environment I have <code>JAVA_HOME</code> set to the proper JDK in a different directory. Plus when I look in IntelliJ for the project, it also shows the JDK in the proper JDK location.  I cannot find anything that attempts to point the JDK to the Intellij JRE location.</p>
  
  <p>Any ideas please?</p>