title: Java ant Eclipse run error
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/6285301/ant-error-java-home-does-not-point-to-sdk">ant error JAVA_HOME does not point to SDK</a>  </p>
  </blockquote>
  
  
  
  <p>I'm getting the following error:</p>
  
  <blockquote>
  <pre><code>BUILD FAILED
  C:\Users\myname\Documents\CMSC\Proj1\build.xml:22: 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 (x86)\Java\jre7"
  
  Total time: 1 second
  </code></pre>
  </blockquote>
  
  <p>My build.xml file contains the following code:</p>
  
  <pre><code>&lt;project name="Project1" default="compile" basedir="."&gt;
  
    &lt;description&gt;
      Build file for Project1
    &lt;/description&gt;
  
    &lt;!-- global properties for this build file --&gt;
    &lt;property name="source.dir" location="src"/&gt;
    &lt;property name="build.dir" location="bin"/&gt;
    &lt;property name="doc.dir" location="doc"/&gt;
    &lt;property name="main.class" value="proj1.Project1"/&gt;
  
    &lt;!-- set up some directories used by this project --&gt;
    &lt;target name="init" description="setup project directories"&gt;
      &lt;mkdir dir="${build.dir}"/&gt;
      &lt;mkdir dir="${doc.dir}"/&gt;
    &lt;/target&gt;
  
    &lt;!-- Compile the java code in ${src.dir} into ${build.dir} --&gt;
    &lt;target name="compile" depends="init" description="compile java sources"&gt;
      &lt;javac srcdir="${source.dir}" destdir="${build.dir}"/&gt;
    &lt;/target&gt;
  
    &lt;!-- execute the program with the fully qualified name in ${build.dir} --&gt;
    &lt;target name="run" description="run the project"&gt;
      &lt;java dir="${build.dir}" classname="${main.class}" fork="yes"&gt;
          &lt;arg line="${args}"/&gt;
      &lt;/java&gt;
    &lt;/target&gt;
  
    &lt;!-- Delete the build &amp; doc directories and Emacs backup (*~) files --&gt;
    &lt;target name="clean" description="tidy up the workspace"&gt;
      &lt;delete dir="${build.dir}"/&gt;
      &lt;delete dir="${doc.dir}"/&gt;
      &lt;delete&gt;
        &lt;fileset defaultexcludes="no" dir="${source.dir}" includes="**/*~"/&gt;
      &lt;/delete&gt;
    &lt;/target&gt;
  
    &lt;!-- Generate javadocs for current project into ${doc.dir} --&gt;
    &lt;target name="doc" depends="init" description="generate documentation"&gt;
      &lt;javadoc sourcepath="${source.dir}" destdir="${doc.dir}"/&gt;
    &lt;/target&gt;
  
  &lt;/project&gt;
  </code></pre>
  
  <p>What am I doing wrong here? It appears that it's trying to find a javac file in my src folder but I don't know how to fix that.</p>