Share this page 

Document a package using Javadoc Tag(s): Environment

Suppose I have a package called com.rgagnon with one HelloWorld class.
In the directory containing, add a file called package.html.

This must be a complete HTML file (with HEAD and BODY). the first line of the body will be used a the package description by javadoc.

this is <i>com.rgagnon</i> package description, 
see <a href="" target="_top">web site</a>
Now execute the javadoc utility located in [JDK]\bin directory from the root of the com.rgagnon package.
\progra~1\Java\jdk1.5.0\bin\javadoc -d javadoc0 -linksource com.rgagnon
where -d javadoc0 is used to specify the output directory and
-linksource to create HTML version of the source file.

See the result.

Since JDK 1.5, to create a package comment file, you have a choice of two files to place your comments:

  • - Can contain a package declaration, package annotations, package comments and Javadoc tags. This file is new in JDK 5.0, and is preferred over package.html.
  • package.html - Can contain only package comments and Javadoc tags, no package annotations.