Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CreateProcess error=2 running javadoc from Ant

Tags:

ant

Can anyone tell me why I am getting this error message

Buildfile: C:\Users\Tara\workspace\Testing\build.xml
doc:
   [delete] Deleting directory C:\Users\Tara\workspace\Testing\doc 
    [mkdir] Created dir: C:\Users\Tara\workspace\Testing\doc 
  [javadoc] Generating Javadoc
  [javadoc] Javadoc execution

BUILD FAILED
C:\Users\Tara\workspace\Testing\build.xml:24: Javadoc failed: java.io.IOException: Cannot run program "javadoc.exe": CreateProcess error=2, The system cannot find the file specified

Total time: 206 milliseconds

when I run this in Eclipse?

<project name="SimpleBuildScript" basedir="." default="doc">
<property file="build.properties"/>
<target name="compile" description="Compiles the Task">
    <delete dir="${class.dir}"/>
    <mkdir dir="${class.dir}"/>
        <javac srcdir="src" destdir="classes"/>
</target>

<target name="clean" description="Delete all generated files">
        <delete dir="${class.dir}"/>
        <delete dir="${jar.dir}"/>
</target>

<target name="doc" description="generate documentation">
    <delete dir="${doc.dir}"/>
    <mkdir dir="${doc.dir}"/>
        <javadoc sourcepath="${source.dir}" destdir="${doc.dir}"/>
</target>
</project>
like image 611
taraloca Avatar asked Sep 04 '10 17:09

taraloca


2 Answers

Providing you have a jdk installed and added to Eclipse:

  1. Windows->Preferences Java->Installed
  2. JREs->Add

You can then

  1. Right click on build.xml
  2. Select Run As->Ant Build... note the ellipsis!
  3. Switch to JRE tab
  4. Select the jdk from the list

Credit for a similar solution: http://blog.darevay.com/2008/12/running-javadoc-ant-task-from-eclipse/

like image 163
Tomasz Avatar answered Sep 21 '22 13:09

Tomasz


I came across the same issue and solved it by adding an additional JREs definitions under:

Windows > Preferences > Java > Installed JREs

Installed JREs Eclipse screenshot

At the time it failed, I was using Jre7 in C:\Program Files\Java\jre7 then I have added and selected Jre in C:\Program Files\Java\jdk1.7.0_07\jre.

like image 30
paranzana Avatar answered Sep 19 '22 13:09

paranzana