Javadoc
Javadoc
Tools Practice
One of the more useful tools in the JDK toolkit is javadoc. This tool is used
to produce documentation pages from comments embedded within our Java
programs. The document pages are automatically produced in HTML with a
distinctive style that has come to be associated with Java documentation. In
order to use javadoc, we must first embed special comments within our
program. These comments have the form:
The comment begins with “/**” and ends (as do all comment blocks) with
“*/”. We associate these blocks with specific parts of our .java file by
placing the special comment block directly before that part of the code.
The general form for a .java file with javadoc comments is as follows:
command “javadoc” alone and without specifying any input parameters. The
resulting error message lists the command’s options and parameters:
usage: javadoc [options] [packagenames] [sourcefiles] [classnames] [@files]
-overview <file> Read overview documentation from HTML file
-public Show only public classes and members
-protected Show protected/public classes and members (default)
-package Show package/protected/public classes and members
-private Show all classes and members
-help Display command line options
-doclet <class> Generate output via alternate doclet
-docletpath <path> Specify where to find doclet class files
-1.1 Generate output using JDK 1.1 emulating doclet
-sourcepath <pathlist> Specify where to find source files
-classpath <pathlist> Specify where to find user class files
-bootclasspath <pathlist> Override location of class files loaded
by the bootstrap class loader
-extdirs <dirlist> Override location of installed extensions
-verbose Output messages about what Javadoc is doing
-locale <name> Locale to be used, e.g. en_US or en_US_WIN
-encoding <name> Source file encoding name
-J<flag> Pass <flag> directly to the runtime system