title: Jenkins using wrong version of Java
body: <p>I'm trying to get Jenkins work on Windows machine. For testing purpose I've installed Jenkins on my localhost. <code>Java_home</code> and <code>path</code> are pointing to java 14(Extracted from zip). I had jre7 and jre 8 installed on my machine so removed them to get rid of the classpath errors i had earlier. I had to manually delete java.exe javaw.exe from the system32 folder. </p>
  
  <p>I run ant build from command prompt, it works without any issues. Now I build the same project in Jenkins which is also on the same machine, i get the following exception.</p>
  
  <p>Where do I specify the Java version within Jenkins so it starts using the JAVA_HOME and Path?</p>
  
  <pre><code>[CommonUtilities] $ cmd.exe /C '"ant.bat -file exported_build.xml build &amp;&amp; exit %%ERRORLEVEL%%"'
  Error: could not open `C:\Program Files (x86)\Java\jre7\lib\i386\jvm.cfg'
  Build step 'Invoke Ant' marked build as failure
  Finished: FAILURE
  </code></pre>
  
  <p><strong>Update:</strong> </p>
  
  <pre><code>&gt;echo %JAVA_HOME%
  C:\tools\bea\jdk142_19
  
  &gt;echo %PATH%
  C:\TDS\Ora\product\11.2.0\client_1\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS
  \System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\W
  indowsPowerShell\v1.0\;C:\Program Files\TortoiseSVN\bin;C:\tools\bea\jdk142_08\b
  in;C:\tools\Build\ant\apache-ant-1.8.2\bin;
  </code></pre>