Java Reference
In-Depth Information
Figure B-1.
The generated HTML page for the Calc class documentation comment
Running the javadoc Tool
You need to run the
javadoc
command-line tool to generate HTML pages for your documentation comments in the
source files (
.java
files). For these examples of running the
javadoc
tool, I assume that the following files contain
documentation comments:
C:\projects\src\overview.html
C:\projects\src\com\jdojo\chapter2\package-info.java
C:\projects\src\com\jdojo\chapter2\Welcome.java
C:\projects\src\com\jdojo\utility\Calc.java
C:\projects\src\com\jdojo\utility\Dummy.java
C:\projects\src\com\jdojo\utility\package-info.java
The
overview.html
file is the overview documentation file for the documentation. There are two
package-info.
java
files, one for
com.jdojo.chapter2
package and one for
com.jdojo.utility
package.
Welcome.java
,
Calc.java
and
Dummy.java
are Java source files.
You will need to open the command prompt, for example a DOS prompt in Windows, to run the
javadoc
tool.
All of the following examples of running the
javadoc
tool assume that the current directory is
C:\projects
. I will use
relative paths to the files and directories in the examples that will be relative to
C:\projects
directory. If you do not
get the desired results with the relative paths, you can absolute paths. For example, if you use
src
in your commands,
it means
C:\projects\src
and you can always replace
src
with
C:\projects\src
in the examples. You will use
C:\projects\docs
directory to store the documentation comments files that are generated by the
javadoc
tool.