Tuesday, May 21, 2013

Java - Generating Javadocs Using Eclipse

Generating Javadocs Using Eclipse

                               
The more I use the Eclipse IDE, the more I’m surprised at what it can do. The other day, for instance, I was thinking that I’d like to find a GUI tool that would generate Javadocs for my project. Before Googling though, I checked my Eclipse documentation and found that the feature was already there. All I had to do was tell Eclipse where to find javadoc.exe. For anyone interested, here is the procedure using Eclipse 3.1 in a Windows environment.

- Step 1 -

Click to highlight the project for which you want to create the Javadocs. Next, from he Project menu, select Generate Javadoc…. You’ll see the following dialog:
Fill in the path of the javadoc.exe file.
On my system it is located at C:\Program Files\Java\jdk1.5.0_04\bin\javadoc.exe. Now select the packages for which you want Javadocs. Unless you want to change the Destination to which the Javadocs will be saved, you can choose Next>.

- Step 2 -

You should now see the following dialog.
If you would like to link your javadoc to another Javadoc, select them. When you do this, any inherited methods listed on you Javadoc will link to the class from which they are inherited. I chose rt.jar to link with the main Java classes. Before, this will work, however, you need to tell Eclipse the location of these other Javadocs. To specify the location, double-click rt.jar and you should see the following dialog.
Enter http://java.sun.com/j2se/1.5.0/docs/api/ for rt.jar (assuming you’re using JDK 1.5), or the location of the Javadoc on your computer, if you have a local copy. Click OK then click Next>.

- Step 3 -

If you want, you can now have Eclipse generate an Ant script that you can use to rebuild your Javadocs automatically. Setting up Ant, is beyond the scope of this blog entry. However, you can also do it manually any time by right-clicking on the script (javadoc.xml by default)from Package Explorer and choosing Run as->Ant Build.
Click Finish and Eclipse will begin to generate your Javadocs. It will place them in a folder in the root of your project. To get the main document open index.html. You’re all set.
           
Trouble Shooting


Missing Generate Javadocs
→ There is Generate Javadoc off of File>Export>Javadoc>Next


Source:
http://www.stupidjavatricks.com/2005/09/generating-javadocs-using-eclipse/


0 comments:

Post a Comment