File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Ant, Maven and Other Build Tools and the fly likes doing javadoc with ant in eclipse Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "doing javadoc with ant in eclipse" Watch "doing javadoc with ant in eclipse" New topic

doing javadoc with ant in eclipse

Jason Hocker
Ranch Hand

Joined: Jul 23, 2003
Posts: 132
I have a build.xml that wants to do javadoc, but get the error...

Cannot run program "javadoc.exe": CreateProcess error=2, The system cannot find the file specified

How do I set the path?
Pavan Kumar
Ranch Hand

Joined: Jan 23, 2004
Posts: 78
Create Process Error=2 normally occurs when you don't have the specified process in path.

This is one way of doing it in ant (haven't tested this)
if you have a JAVA_HOME variable set, you could refer to the javadoc.exe as follows.

There may be other elegant ways. for instance the javadoc task in ant may be a better choice than exec. Or may be you could add JAVA_HOME/bin to your path.

formerly known as Cnu
Jason Hocker
Ranch Hand

Joined: Jul 23, 2003
Posts: 132
I planned to use the javadoc method. I am new to ant, so I appreciate any help.
Ilja Preuss

Joined: Jul 11, 2001
Posts: 14112
Can you show us the relevant part(s) of your ant script, please?

The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Jason Hocker
Ranch Hand

Joined: Jul 23, 2003
Posts: 132

[edited to escape XML]
[ March 20, 2007: Message edited by: Jeanne Boyarsky ]
Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 33119

We have a separate forum for Ant, so I'm moving your post there since it has more to do with Ant than Eclipse.

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
Ilja Preuss

Joined: Jul 11, 2001
Posts: 14112
Does the JAVA_HOME environment variable point to a correct JDK root folder?
Carol Enderlin
Ranch Hand

Joined: Oct 10, 2000
Posts: 1364
If you run with -verbose argument you should see what path it is trying to use for javadoc.exe.

Here's mine:
Geoffrey Falk
Ranch Hand

Joined: Aug 17, 2001
Posts: 171
I am having the same problem on my home PC. The strange thing is, it works fine on my computer at work, and they are similarly configured. My JAVA_HOME and ANT_HOME are set correctly.

Why can't Ant find the javadoc executable for the <javadoc> task, the same way it finds the javac executable for the <javac> task?

I just updated my Eclipse to the very latest updates (2009-03-26). I googled this today and found no help either.


Sun Certified Programmer for the Java 2 Platform
Martijn Verburg

Joined: Jun 24, 2003
Posts: 3275

Hi Geoffrey,

We try not to URL=]WakeTheZombies[/URL] around here . Can you post your specific problem in a separate thread? I'd post your full PATH and JAVA_HOME details in the new thread and we can get started!

Cheers, Martijn - Blog,
Twitter, PCGen, Ikasan, My The Well-Grounded Java Developer book!,
My start-up.
I agree. Here's the link:
subject: doing javadoc with ant in eclipse
It's not a secret anymore!