The Java Documentation Tool: javadoc


[Page 827]

The Java Documentation Tool: javadoc

The javadoc tool parses the declarations and documentation comments in a Java source file and generates a set of HTML pages that describes the following elements: public and protected classes, inner classes, interfaces, constructors, methods, and fields.

The javadoc tool can be used on a single file or an entire package of files. Recall that a Java documentation comment is one that begins with /** and ends with */. These are the comments that are parsed by javadoc.

The javadoc tool has many features, and it is possible to use Java doclets to customize your documentation. For full details on using the tool, it is best to consult Sun's Web site. To illustrate how it might be used, let's just look at a simple example.

The FirstApplet program from Chapter 1 contains documentation comments. It was processed using the following command:

javadoc FirstApplet.java 


javadoc generated the following HTML documents:

FirstApplet.html      -The main documentation file allclasses-frame.html -Names and links to all the classes used in                         FirstApplet overview-tree.html    -A tree showing FirstApplet's place                         in the class hierarchy packages.html         -Details on the packages used in FirstApplet index.html            -Top-level HTML document for                         FirstApplet documentation index-all.html        -Summary of all methods and variables in                         FirstApplet 


To see how the documentation appears, review the FirstApplet.java source file and the documentation it generated. Both are available at:

http://www.prenhall.com/morelli/




Java, Java, Java(c) Object-Orienting Problem Solving
Java, Java, Java, Object-Oriented Problem Solving (3rd Edition)
ISBN: 0131474340
EAN: 2147483647
Year: 2005
Pages: 275

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