Using the Javadoc Tool

     

Now that you are ready to generate your documentation, whip out a console and get ready to rumble.

Here's the usage for the Javadoc tool:

 

 javadoc [options] [packagenames] [sourcefiles] [@files] 

To see a full list of usage options, simply get a console and type javadoc “help and hit Enter. Here's a basic way to generate your docs:

  1. At the console, navigate to the directory that contains the package you want to document.

  2. Type javadoc -d DocOutputDirectory PackageName

To document the net.javagarage package and put it into the /eben/home/MyJavaDocs directory, I type this:

 

 >javadoc -d /eben/home/MyJavaDocs net.javagarage 

The utility runs outputting what it is doing along the way. It creates several directories and many files, and when it's done, you have a folder with all of your documentation. Click the index.html file to view it.

Note that you have several options. You can include all of the classes and packages in your application, or just select a few (see Figure 15.1).

Figure 15.1. The index page of the generated documentation.
graphics/15fig01.gif

As you can see, I have only included a few classes from the entire garage kit-and-kaboodle, for simplicity's sake. Notice that it looks exactly like the Java API documentation used online by Sun.

Let's click on the package name to get the class summary for the net.javagarage.apps.swing.layout package. It gives you a list of classes with their descriptions in the main frame (see Figure 15.2).

Figure 15.2. The package's class listing and description.
graphics/15fig02.gif



Java Garage
Java Garage
ISBN: 0321246233
EAN: 2147483647
Year: 2006
Pages: 228
Authors: Eben Hewitt

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net