title: Ant: Class not found: javac1.8
body: <p>I am trying to build a project using Ant in eclipse. I right-clicked on build.xml > Run As > Ant Build. However, I am getting the following error:</p>
  
  <pre><code>BUILD FAILED
  C:\Users\David\eclipse\test-project\build.xml:26: Class not found: javac1.8
  </code></pre>
  
  <p>and also a warning:</p>
  
  <pre><code>compile:
  [javac] C:\Users\David\eclipse\test-project\build.xml:26: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
  </code></pre>
  
  <p>As I read in other posts that this might be due to having an ant version that is too old or not having set the environment variables correctly here is all the info:</p>
  
  <pre><code>C:\&gt;java -version
  java version "1.8.0_05"
  Java(TM) SE Runtime Environment (build 1.8.0_05-b13)
  Java HotSpot(TM) 64-Bit Server VM (build 25.5-b02, mixed mode)
  
  C:\&gt;ant -version
  Apache Ant(TM) version 1.9.3 compiled on December 23 2013
  
  C:\&gt;echo %JAVA_HOME%
  C:\Program Files\Java\jdk1.8.0_05
  
  C:\&gt;echo %JRE_HOME%
  C:\Program Files\Java\jre8
  </code></pre>
  
  <p>EDIT:
  Here is the whole build.xml, line 26 is the javac tag:</p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  &lt;project name="test-project" default="main" basedir="."&gt;
    &lt;!-- Sets variables which can later be used. --&gt;
    &lt;!-- The value of a property is accessed via ${} --&gt;
    &lt;property name="src.dir" location="src" /&gt;
    &lt;property name="build.dir" location="bin" /&gt;
    &lt;property name="dist.dir" location="dist" /&gt;
    &lt;property name="docs.dir" location="docs" /&gt;
  
    &lt;!-- Deletes the existing build, docs and dist directory--&gt;
    &lt;target name="clean"&gt;
      &lt;delete dir="${build.dir}" /&gt;
      &lt;delete dir="${docs.dir}" /&gt;
      &lt;delete dir="${dist.dir}" /&gt;
    &lt;/target&gt;
  
    &lt;!-- Creates the  build, docs and dist directory--&gt;
    &lt;target name="makedir"&gt;
      &lt;mkdir dir="${build.dir}" /&gt;
      &lt;mkdir dir="${docs.dir}" /&gt;
      &lt;mkdir dir="${dist.dir}" /&gt;
    &lt;/target&gt;
  
    &lt;!-- Compiles the java code (including the usage of library for JUnit --&gt;
    &lt;target name="compile" depends="clean, makedir"&gt;
      &lt;javac srcdir="${src.dir}" destdir="${build.dir}"&gt;
      &lt;/javac&gt;
    &lt;/target&gt;
  
    &lt;!-- Creates Javadoc --&gt;
    &lt;target name="docs" depends="compile"&gt;
      &lt;javadoc packagenames="src" sourcepath="${src.dir}" destdir="${docs.dir}"&gt;
        &lt;!-- Define which files / directory should get included, we include all --&gt;
         &lt;fileset dir="${src.dir}"&gt;
                  &lt;include name="**" /&gt;
             &lt;/fileset&gt;
      &lt;/javadoc&gt;
    &lt;/target&gt;
  
    &lt;!--Creates the deployable jar file  --&gt;
    &lt;target name="jar" depends="compile"&gt;
      &lt;jar destfile="${dist.dir}\test-project1.jar" basedir="${build.dir}"&gt;
        &lt;manifest&gt;
          &lt;attribute name="Main-Class" value="test.Main" /&gt;
        &lt;/manifest&gt;
      &lt;/jar&gt;
    &lt;/target&gt;
  
    &lt;target name="main" depends="compile, jar, docs"&gt;
      &lt;description&gt;Main target&lt;/description&gt;
    &lt;/target&gt;
  
  &lt;/project&gt; 
  </code></pre>