title: javadoc.exe not found while running ant
body: <p>I am trying to run some basic ant scripts and while doing so facing following error:</p>
  
  <pre><code>D:\{user...}\build.xml:31: Javadoc failed: java.io.IOException: Cannot run program "javadoc.exe": CreateProcess error=2, The system cannot find the file specified
  </code></pre>
  
  <p>I have already tried searching for solution and came to following solutions:
  <a href="https://stackoverflow.com/questions/3643319/createprocess-error-2-running-javadoc-from-ant">CreateProcess error=2 running javadoc from Ant</a></p>
  
  <ul>
  <li>I am already using JDK. Still facing the issue. javadoc.exe is already present in jdk\bin.</li>
  <li>I am using inbuilt Ant which came with ecplise Kepler Service Release 2.</li>
  <li>If I remove 'docs' target, it's running perfectly.</li>
  </ul>
  
  <p>This is my build.xml:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;project name="Ant-Test" 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="com.ant.vogellaTut.*" 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}\antTraining.jar" basedir="${build.dir}"&gt;
        &lt;manifest&gt;
          &lt;attribute name="Main-Class" value="com.ant.vogellaTut.test.Test" /&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>