< Zurück | Inhalt | Weiter >

5.5.1 Running javadoc

The javadoc command has the following general form:


javadoc [options...] [package names...] [source filenames...] [@optfile...]


Options are covered in the next section. You can specify the classes to document in two ways. First, you can list one or more Java packages on the command line. Source code for the named packages is searched for on the source classpath (see Section 5.5.2). Wildcards are not permitted in package names.

Second, you may list as many Java source files as you like, and you may use wildcards in the names.

As with the javac compiler above, the @optfile allows you to name a text file whose lines are treated as arguments as if they had been typed on the com- mand line.

Example 5.5 shows how to run javadoc on our small multiclass sample.

In this case, we were in the “base directory” of the package when we ran the command. In other words, net was a subdirectory of the current working directory when we ran Javadoc. Javadoc uses the same default classpaths and environment variables as javac does, so by default “.” is on the path.

Generally, specifying packages is the most convenient way to document a number of classes, since packages are how collections of classes are generally managed in Java development.

Figure 5.1 shows the main screen of the documentation thus produced.


image

Example 5.5 Running javadoc with defaults against a package

$ javadoc net.multitool.Payback

Loading source files for package net.multitool.Payback... Constructing Javadoc information...

Standard Doclet version 1.4.1


Generating constant-values.php...

Building tree for all the packages and classes... Building index for all the packages and classes... Generating overview-tree.php...

Generating index-all.php... Generating deprecated-list.php... Building index for all classes... Generating allclasses-frame.php... Generating allclasses-noframe.php... Generating index.php...

Generating packages.php...

Generating net/multitool/Payback/package-frame.php... Generating net/multitool/Payback/package-summary.php... Generating net/multitool/Payback/package-tree.php...

Generating net/multitool/Payback/Account.php... Generating net/multitool/Payback/Cost.php...

Generating net/multitool/Payback/DebtAccount.php... Generating net/multitool/Payback/Payback.php...

Generating net/multitool/Payback/Purchase.php... Generating net/multitool/Payback/SavingsAccount.php... Generating package-list...

Generating help-doc.php... Generating stylesheet.css...

$


image