title: setting JAVA_HOME in windows 7
body: <p>I am getting the following error when I try to run an ant buildfile in eclipse:  </p>
  
  <pre><code>BUILD FAILED
  C:\mypath\myapp\BuildWar.xml:16: Unable to find a javac compiler;
  com.sun.tools.javac.Main is not on the classpath.
  Perhaps JAVA_HOME does not point to the JDK.
  It is currently set to "C:\Program Files\Java\jre7"  
  </code></pre>
  
  <p>I located the jdk at C:\mypath\Java\jdk1.7.0_17\bin\javac.exe  </p>
  
  <p>I used the methods in<a href="http://www.robertsindall.co.uk/blog/setting-java-home-variable-in-windows/" rel="nofollow"> this blog entry</a> to create a system environmental variable in windows 7 called JAVA_HOME and mapped to C:\mypath\Java\jdk1.7.0_17\bin\javac.exe .  When the error persisted, I restarted the computer, tried again, and got the same error.  I then changed the mapping of JAVA_HOME to C:\mypath\Java\jdk1.7.0_17\bin\ and still got the same error.  </p>
  
  <p>Can anyone show me how to get past this error, so that I can run my ant build file in eclipse?  </p>
  
  <hr>
  
  <h2>EDIT:</h2>
  
  <p>I am getting the same exact error message again today when I try to run the ant buildfile, even though JAVA_HOME is set as per the answers below, and even though the path variable now includes %JAVA_HOME%\bin . I have checked the values of these environmental variables in the windows control  panel section for setting environmental variables, even though the eclipse console gives the above error message saying JAVA_HOME is set to a jre.  Does anyone have any suggestions about how to fix this recurring problem?</p>
  
  <hr>
  
  <h2>SECOND EDIT:</h2>
  
  <p>Changing the Java Home in eclipse fixed this problem.  The eclipse Java Home is separate from the windows Java Home.</p>