title: How do I tell Gradle to use specific JDK version?
body: <p>I can't figure out to get this working.</p>
  
  <p>Scenario:</p>
  
  <ul>
  <li>I have an application built with gradle</li>
  <li>The application uses JavaFX</li>
  </ul>
  
  <p>What I want</p>
  
  <ul>
  <li>Use a variable (defined per developer machine) which points to an installation of a JDK which will be used for building the whole application / tests / ...</li>
  </ul>
  
  <p>I thought about having the <code>gradle.properties</code> file, defining the variable. Something like</p>
  
  <pre><code>JAVA_HOME_FOR_MY_PROJECT=&lt;path to my desired JDK&gt;
  </code></pre>
  
  <p>What I don't want</p>
  
  <ul>
  <li>point <code>JAVA_HOME</code> to the desired JDK</li>
  </ul>
  
  <p>I could live with many suggestions:</p>
  
  <ul>
  <li>a solution that defines a system environment variable which I'm able to check in my build.gradle script</li>
  <li>a variable defined in gradle.properties</li>
  <li>overriding the JAVA_HOME variable only for the build context (something like <code>use JAVA_HOME=&lt;my special JDK path defined somewhere else defined&gt;</code>)</li>
  <li>something else I didn't think about</li>
  </ul>
  
  <p>Question:</p>
  
  <ul>
  <li>How to wire a variable (how ever defined, as variable in the <code>gradle.properties</code>, system environment variable, ...) to the build process?</li>
  </ul>
  
  <p>I have more than one JDK7 available and need to point to a special version (minimum JDK_u version).</p>
  
  <p>Any answer is appreciated and I'm thankful for every hint to the right direction.</p>