Whenever you prepare a release of a Java project, it’s a good idea to create some Javadoc documentation to accompany it. This is especially true for an open source project. Generating Javadoc with the Eclipse IDE really couldn’t be much easier.
- Select Project -> Generate Javadoc… from the menubar.
- The first time you use the Javadoc tool, you may need to set the Javadoc command. Hit the configure button and navigate to the bin directory of your JDK, you’re looking for javadoc.exe. On windows this is likely to be something like: C:\Program Files\Java\jdk1.6.x_xx\bin\javadoc.exe, on linux it may be more like /usr/bin/javadoc.
- Check the checkbox for the project you want Javadoc to be generated for.
- You probably only want Javadoc for members with Public or Protected visibility.
- Hit Finish, and that’s it. Your Javadoc will be generated in a doc directory in your project root.
- Open doc/index.html in your browser to view.
Remember that the quality of your Javadoc is dependent on the quality of your comments. For information about writing good doc comments see the Sun style guide.