Generating Javadoc with Eclipse

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.

  1. Select Project -> Generate Javadoc… from the menubar.

    Eclipse's Javadoc dialog

    Eclipse's Javadoc dialog

  2. 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.
  3. Check the checkbox for the project you want Javadoc to be generated for.
  4. You probably only want Javadoc for members with Public or Protected visibility.
  5. Hit Finish, and that’s it. Your Javadoc will be generated in a doc directory in your project root.
  6. 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.

Tagged with: ,
Posted in Eclipse, Java

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">