blob: ea6a6dd4d4474378d038741862117a40774643b4 [file] [log] [blame]
tbell16c34dd2009-05-04 18:28:26 -07001." Copyright 2002-2006 Sun Microsystems, Inc. All Rights Reserved.
duke6e45e102007-12-01 00:00:00 +00002." DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3."
4." This code is free software; you can redistribute it and/or modify it
5." under the terms of the GNU General Public License version 2 only, as
6." published by the Free Software Foundation.
7."
8." This code is distributed in the hope that it will be useful, but WITHOUT
9." ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10." FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
11." version 2 for more details (a copy is included in the LICENSE file that
12." accompanied this code).
13."
14." You should have received a copy of the GNU General Public License version
15." 2 along with this work; if not, write to the Free Software Foundation,
16." Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
17."
18." Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
19." CA 95054 USA or visit www.sun.com if you need additional information or
20." have any questions.
21."
tbell16c34dd2009-05-04 18:28:26 -070022.TH javadoc 1 "04 May 2009"
23." Generated from HTML by html2man (author: Eric Armstrong)
24.SH "Name"
duke6e45e102007-12-01 00:00:00 +000025javadoc \- The Java API Documentation Generator
26.RS 3
27
28.LP
29.LP
30Generates HTML pages of API documentation from Java source files. This document contains Javadoc examples for Sun Solaris.
31.LP
32.RE
33.SH "SYNOPSIS"
34.LP
35.LP
36\f4javadoc\fP\f2\ [\ \fP\f2options\fP\f2\ ]\ [\ packagenames\ ]\ [\ sourcefilenames\ ]\ [\ \-subpackages\fP\ \f2pkg1:pkg2:...\fP\f2\ ]\ [\ \fP\f2@argfiles\fP\f2\ ]\fP
37.LP
38.LP
39Arguments can be in any order. See processing of Source Files for details on how the Javadoc tool determines which "\f2.java\fP" files to process.
40.LP
41.RS 3
42
43.LP
44.RS 3
45.TP 3
46options
47Command\-line options, as specified in this document. To see a typical use of javadoc options, see Real\-World Example.
48.TP 3
49packagenames
50A series of names of packages, separated by spaces, such as \f2java.lang\ java.lang.reflect\ java.awt\fP. You must separately specify each package you want to document. Wildcards are not allowed; use \-subpackages for recursion. The Javadoc tool uses \f2\-sourcepath\fP to look for these package names. See Example \- Documenting One or More Packages
51.TP 3
52sourcefilenames
53A series of source file names, separated by spaces, each of which can begin with a path and contain a wildcard such as asterisk (*). The Javadoc tool will process every file whose name ends with ".java", and whose name, when stripped of that suffix, is actually a legal class name (see
54.na
55\f2Identifiers\fP @
56.fi
57http://java.sun.com/docs/books/jls/second_edition/html/lexical.doc.html#40625). Therefore, you can name files with dashes (such as \f2X\-Buffer\fP), or other illegal characters, to prevent them from being documented. This is useful for test files and template files The path that precedes the source file name determines where javadoc will look for the file. (The Javadoc tool does \f2not\fP use \f2\-sourcepath\fP to look for these source file names.) Relative paths are relative to the current directory, so passing in \f2Button.java\fP is identical to \f2./Button.java\fP. A source file name with an absolute path and a wildcard, for example, is \f2/home/src/java/awt/Graphics*.java\fP. See Example\ \-\ Documenting One or More Classes. You can also mix packagenames and sourcefilenames, as in Example\ \-\ Documenting Both Packages and Classes
58.TP 3
59\-subpackages pkg1:pkg2:...
60Generates documentation from source files in the specified packages and recursively in their subpackages. An alternative to supplying packagenames or sourcefilenames.
61.TP 3
62@argfiles
63One or more files that contain a list of Javadoc options, packagenames and sourcefilenames in any order. Wildcards (*) and \f2\-J\fP options are not allowed in these files.
64.RE
65
66.LP
67.RE
68.SH "DESCRIPTION"
69.LP
70.LP
71The \f3Javadoc\fP tool parses the declarations and documentation comments in a set of Java source files and produces a corresponding set of HTML pages describing (by default) the public and protected classes, nested classes (but not anonymous inner classes), interfaces, constructors, methods, and fields. You can use it to generate the API (Application Programming Interface) documentation or the implementation documentation for a set of source files.
72.LP
73.LP
74You can run the Javadoc tool on entire packages, individual source files, or both. When documenting entire packages, you can either use \f2\-subpackages\fP for traversing recursively down from a top\-level directory, or pass in an explicit list of package names. When documenting individual source files, you pass in a list of source (\f2.java\fP) filenames. Examples are given at the end of this document. How Javadoc processes source files is covered next.
75.LP
76.SS
77Processing of source files
78.LP
79.LP
80The Javadoc tool processes files that end in "\f2.java\fP" plus other files described under Source Files. If you run the Javadoc tool by explicitly passing in individual source filenames, you can determine exactly which "\f2.java\fP" files are processed. However, that is not how most developers want to work, as it is simpler to pass in package names. The Javadoc tool can be run three ways without explicitly specifying the source filenames. You can (1) pass in package names, (2) use \f2\-subpackages\fP, and (3) use wildcards with source filenames (\f2*.java\fP). In these cases, the Javadoc tool processes a "\f2.java\fP" file only if it fulfills all of the following requirements:
81.LP
82.RS 3
83.TP 2
84o
85Its name, after stripping off the "\f2.java\fP" suffix, is actually a legal class name (see
86.na
87\f2Identifiers\fP @
88.fi
89http://java.sun.com/docs/books/jls/second_edition/html/lexical.doc.html#40625 for legal characters)
90.TP 2
91o
92Its directory path relative to the root of the source tree is actually a legal package name (after converting its separators to dots)
93.TP 2
94o
95Its package statement contains the legal package name (specified in the previous bullet)
96.RE
97
98.LP
99.LP
100\f3Processing of links\fP \- During a run, the Javadoc tool automatically adds cross\-reference links to package, class and member names that are being documented as part of that run. Links appear in several places:
101.LP
102.RS 3
103.TP 2
104o
105Declarations (return types, argument types, field types)
106.TP 2
107o
108"See Also" sections generated from \f2@see\fP tags
109.TP 2
110o
111In\-line text generated from \f2{@link}\fP tags
112.TP 2
113o
114Exception names generated from \f2@throws\fP tags
115.TP 2
116o
117"Specified by" links to members in interfaces and "Overrides" links to members in classes
118.TP 2
119o
120Summary tables listing packages, classes and members
121.TP 2
122o
123Package and class inheritance trees
124.TP 2
125o
126The index
127.RE
128
129.LP
130.LP
131You can add hyperlinks to existing text for classes not included on the command line (but generated separately) by way of the \f2\-link\fP and \f2\-linkoffline\fP options.
132.LP
133.LP
134\f3Other processing details\fP \- The Javadoc tool produces one complete document each time it is run; it cannot do incremental builds \-\- that is, it cannot modify or \f2directly\fP incorporate results from previous runs of the Javadoc tool. However, it can link to results from other runs, as just mentioned.
135.LP
136.LP
137As implemented, the Javadoc tool requires and relies on the java compiler to do its job. The Javadoc tool calls part of \f2javac\fP to compile the declarations, ignoring the member implementation. It builds a rich internal representation of the classes, including the class hierarchy, and "use" relationships, then generates the HTML from that. The Javadoc tool also picks up user\-supplied documentation from documentation comments in the source code.
138.LP
139.LP
140In fact, the Javadoc tool will run on \f2.java\fP source files that are pure stub files with no method bodies. This means you can write documentation comments and run the Javadoc tool in the earliest stages of design while creating the API, before writing the implementation.
141.LP
142.LP
143Relying on the compiler ensures that the HTML output corresponds exactly with the actual implementation, which may rely on implicit, rather than explicit, source code. For example, the Javadoc tool documents
144.na
145\f2default constructors\fP @
146.fi
147http://java.sun.com/docs/books/jls/second_edition/html/names.doc.html#36154 (section 8.6.7 of \f2Java Language Specification\fP) that are present in the \f2.class\fP files but not in the source code.
148.LP
149.LP
150In many cases, the Javadoc tool allows you to generate documentation for source files whose code is incomplete or erroneous. This is a benefit that enables you to generate documentation before all debugging and troubleshooting is done. For example, according to the \f2Java Language Specification\fP, a class that contains an abstract method should itself be declared abstract. The Javadoc tool does not check for this, and would proceed without a warning, whereas the javac compiler stops on this error. The Javadoc tool does do some primitive checking of doc comments. Use the DocCheck doclet to check the doc comments more thoroughly.
151.LP
152.LP
tbell16c34dd2009-05-04 18:28:26 -0700153When the Javadoc tool builds its internal structure for the documentation, it loads all referenced classes. Because of this, the Javadoc tool must be able to find all referenced classes, whether bootstrap classes, extensions, or user classes. For more about this, see
154.na
155\f2How Classes Are Found\fP @
156.fi
157http://java.sun.com/javase/6/docs/technotes/tools/findingclasses.html. Generally speaking, classes you create must either be loaded as an extension or in the Javadoc tool's class path.
duke6e45e102007-12-01 00:00:00 +0000158.LP
159.SS
160Javadoc Doclets
161.LP
162.LP
163You can customize the content and format of the Javadoc tool's output by using doclets. The Javadoc tool has a default "built\-in" doclet, called the standard doclet, that generates HTML\-formatted API documentation. You can modify or subclass the standard doclet, or write your own doclet to generate HTML, XML, MIF, RTF or whatever output format you'd like. Information about doclets and their use is at the following locations:
164.LP
165.RS 3
166.TP 2
167o
tbell16c34dd2009-05-04 18:28:26 -0700168.na
169\f2Javadoc Doclets\fP @
170.fi
171http://java.sun.com/javase/6/docs/technotes/guides/javadoc/index.html
duke6e45e102007-12-01 00:00:00 +0000172.TP 2
173o
174The \f2\-doclet\fP command\-line option
175.RE
176
177.LP
178.LP
179When a custom doclet is not specified with the \f2\-doclet\fP command line option, the Javadoc tool will use the default standard doclet. The javadoc tool has several command line options that are available regardless of which doclet is being used. The standard doclet adds a supplementary set of command line options. Both sets of options are described below in the options section.
180.LP
181.SS
182Related Documentation and Doclets
183.LP
184.RS 3
185.TP 2
186o
tbell16c34dd2009-05-04 18:28:26 -0700187.na
188\f2Javadoc Enhancements\fP @
189.fi
190http://java.sun.com/javase/6/docs/technotes/guides/javadoc/index.html for details about improvements added in Javadoc.
duke6e45e102007-12-01 00:00:00 +0000191.TP 2
192o
193.na
194\f2Javadoc FAQ\fP @
195.fi
196http://java.sun.com/j2se/javadoc/faq/index.html for answers to common questions, information about Javadoc\-related tools, and workarounds for bugs.
197.TP 2
198o
199.na
200\f2How to Write Doc Comments for Javadoc\fP @
201.fi
202http://java.sun.com/j2se/javadoc/writingdoccomments/index.html for more information about Sun conventions for writing documentation comments.
203.TP 2
204o
205.na
206\f2Requirements for Writing API Specifications\fP @
207.fi
tbell16c34dd2009-05-04 18:28:26 -0700208http://java.sun.com/j2se/javadoc/writingapispecs/index.html \- Standard requirements used when writing the Java SE Platform Specification. It can be useful whether you are writing API specifications in source file documentation comments or in other formats. It covers requirements for packages, classes, interfaces, fields and methods to satisfy testable assertions.
duke6e45e102007-12-01 00:00:00 +0000209.TP 2
210o
211.na
212\f2Documentation Comment Specification\fP @
213.fi
214http://java.sun.com/docs/books/jls/first_edition/html/18.doc.html \- The original specification on documentation comments, Chapter 18, Documentation Comments, in the \f2Java Language Specification\fP, First Edition, by James Gosling, Bill Joy, and Guy Steele. (This chapter was removed from the second edition.)
215.TP 2
216o
217.na
218\f2DocCheck Doclet\fP @
219.fi
220http://java.sun.com/javadoc/doccheck \- Checks doc comments in source files and generates a report listing the errors and irregularities it finds. It is part of the Sun Doc Check Utilities.
221.TP 2
222o
223.na
224\f2MIF Doclet\fP @
225.fi
226http://java.sun.com/javadoc/mifdoclet \- Can automate the generation of API documentation in MIF, FrameMaker and PDF formats. MIF is Adobe FrameMaker's interchange format.
227.RE
228
229.LP
230.SS
231Terminology
232.LP
233.LP
234The terms \f2documentation comment\fP, \f2doc comment\fP, \f2main description\fP, \f2tag\fP, \f2block tag\fP, and \f2in\-line tag\fP are described at Documentation Comments. These other terms have specific meanings within the context of the Javadoc tool:
235.LP
236.RS 3
237.TP 3
238generated document
239The document generated by the javadoc tool from the doc comments in Java source code. The default generated document is in HTML and is created by the standard doclet.
240.LP
241.TP 3
242name
243A name of a program element written in the Java Language \-\- that is, the name of a package, class, interface, field, constructor or method. A name can be fully\-qualified, such as \f2java.lang.String.equals(java.lang.Object)\fP, or partially\-qualified, such as \f2equals(Object)\fP.
244.LP
245.TP 3
246documented classes
247The classes and interfaces for which detailed documentation is generated during a javadoc run. To be documented, the source files must be available, their source filenames or package names must be passed into the javadoc command, and they must not be filtered out by their access modifier (public, protected, package\-private or private). We also refer to these as the classes included in the javadoc output, or the \f2included classes\fP.
248.LP
249.TP 3
250included classes
251Classes and interfaces whose details are documented during a run of the Javadoc tool. Same as \f2documented classes\fP.
252.LP
253.TP 3
254excluded classes
255Classes and interfaces whose details are \f2not\fP documented during a run of the Javadoc tool.
256.LP
257.TP 3
258referenced classes
259The classes and interfaces that are explicitly referred to in the definition (implementation) or doc comments of the documented classes and interfaces. Examples of references include return type, parameter type, cast type, extended class, implemented interface, imported classes, classes used in method bodies, @see, {@link}, {@linkplain}, and {@inheritDoc} tags. (Notice this definition has changed since
260.na
261\f21.3\fP @
262.fi
263http://java.sun.com/j2se/1.3/docs/tooldocs/solaris/javadoc.html#referencedclasses.) When the Javadoc tool is run, it should load into memory all of the referenced classes in javadoc's bootclasspath and classpath. (The Javadoc tool prints a "Class not found" warning for referenced classes not found.) The Javadoc tool can derive enough information from the .class files to determine their existence and the fully\-qualified names of their members.
264.LP
265.TP 3
266external referenced classes
267The referenced classes whose documentation is not being generated during a javadoc run. In other words, these classes are not passed into the Javadoc tool on the command line. Links in the generated documentation to those classes are said to be \f2external references\fP or \f2external links\fP. For example, if you run the Javadoc tool on only the \f2java.awt\fP package, then any class in \f2java.lang\fP, such as \f2Object\fP, is an external referenced class. External referenced classes can be linked to using the \f2\-link\fP and \f2\-linkoffline\fP options. An important property of an external referenced class is that its source comments are normally not available to the Javadoc run. In this case, these comments cannot be inherited.
268.RE
269
270.LP
271.SH "SOURCE FILES"
272.LP
273.LP
274The Javadoc tool will generate output originating from four different types of "source" files: Java language source files for classes (\f2.java\fP), package comment files, overview comment files, and miscellaneous unprocessed files. This section also covers test files and template files that can also be in the source tree, but which you want to be sure not to document.
275.LP
276.SS
277Class Source Code Files
278.LP
279.LP
280Each class or interface and its members can have their own documentation comments, contained in a \f2.java\fP file. For more details about these doc comments, see Documentation Comments.
281.LP
282.SS
283Package Comment Files
284.LP
285.LP
286Each package can have its own documentation comment, contained in its own "source" file, that the Javadoc tool will merge into the package summary page that it generates. You typically include in this comment any documentation that applies to the entire package.
287.LP
288.LP
289To create a package comment file, you have a choice of two files to place your comments:
290.LP
291.RS 3
292.TP 2
293o
tbell16c34dd2009-05-04 18:28:26 -0700294\f2package\-info.java\fP \- Can contain a package declaration, package annotations, package comments and Javadoc tags. This file is generally preferred over package.html.
duke6e45e102007-12-01 00:00:00 +0000295.TP 2
296o
297\f2package.html\fP \- Can contain only package comments and Javadoc tags, no package annotations.
298.RE
299
300.LP
301.LP
302A package may have a single \f2package.html\fP file or a single \f2package\-info.java\fP file but not both. Place either file in the package directory in the source tree along with your \f2.java\fP files.
303.LP
304.LP
tbell16c34dd2009-05-04 18:28:26 -0700305\f4package\-info.java\fP \- This file can contain a package comment of the following structure \-\- the comment is placed before the package declaration:
duke6e45e102007-12-01 00:00:00 +0000306.LP
307.LP
308File: \f2java/applet/package\-info.java\fP
309.LP
310.LP
311.TS
312.if \n+(b.=1 .nr d. \n(.c-\n(c.-1
313.de 35
314.ps \n(.s
315.vs \n(.vu
316.in \n(.iu
317.if \n(.u .fi
318.if \n(.j .ad
319.if \n(.j=0 .na
320..
321.nf
322.nr #~ 0
323.if n .nr #~ 0.6n
324.ds #d .d
325.if \(ts\n(.z\(ts\(ts .ds #d nl
326.fc
327.nr 33 \n(.s
328.rm 80
329.nr 34 \n(.lu
330.eo
331.am 80
332.br
333.di a+
334.35
335.ft \n(.f
336.ll \n(34u*1u/2u
337.if \n(.l<\n(80 .ll \n(80u
338.in 0
339.nf
340\f3
341.fl
342/**
343.fl
344 * Provides the classes necessary to create an
345.fl
346 * applet and the classes an applet uses
347.fl
348 * to communicate with its applet context.
349.fl
350 * <p>
351.fl
352 * The applet framework involves two entities:
353.fl
354 * the applet and the applet context.
355.fl
356 * An applet is an embeddable window (see the
357.fl
358 * {@link java.awt.Panel} class) with a few extra
359.fl
360 * methods that the applet context can use to
361.fl
362 * initialize, start, and stop the applet.
363.fl
364 *
365.fl
366 * @since 1.0
367.fl
368 * @see java.awt
369.fl
370 */
371.fl
372package java.lang.applet;
373.fl
374\fP
375.fi
376.br
377.di
378.nr a| \n(dn
379.nr a- \n(dl
380..
381.ec \
382.35
383.nf
384.ll \n(34u
385.nr 80 0
386.80
387.rm 80
388.nr 38 \n(a-
389.if \n(80<\n(38 .nr 80 \n(38
390.35
391.nf
392.ll \n(34u
393.nr 38 1n
394.nr 79 0
395.nr 40 \n(79+(0*\n(38)
396.nr 80 +\n(40
397.nr TW \n(80
tbell16c34dd2009-05-04 18:28:26 -0700398.if t .if \n(TW>\n(.li .tm Table at line 353 file Input is too wide - \n(TW units
duke6e45e102007-12-01 00:00:00 +0000399.fc  
400.nr #T 0-1
401.nr #a 0-1
402.eo
403.de T#
404.ds #d .d
405.if \(ts\n(.z\(ts\(ts .ds #d nl
406.mk ##
407.nr ## -1v
408.ls 1
409.ls
410..
411.ec
412.ne \n(a|u+\n(.Vu
413.if (\n(a|+\n(#^-1v)>\n(#- .nr #- +(\n(a|+\n(#^-\n(#--1v)
414.ta \n(80u
415.nr 31 \n(.f
416.nr 35 1m
417\&\h'|\n(40u'
418.mk ##
419.nr 31 \n(##
420.sp |\n(##u-1v
421.nr 37 \n(40u
422.in +\n(37u
423.a+
424.in -\n(37u
425.mk 32
426.if \n(32>\n(31 .nr 31 \n(32
427.sp |\n(31u
428.fc
429.nr T. 1
430.T# 1
431.35
432.rm a+
433.TE
434.if \n-(b.=0 .nr c. \n(.c-\n(d.-42
435
436.LP
437.LP
438Note that while the comment separators \f2/**\fP and \f2/*\fP must be present, the leading asterisks on the intermediate lines can be omitted.
439.LP
440.LP
441\f4package.html\fP \- This file can contain a package comment of the following structure \-\- the comment is placed in the \f2<body>\fP element:
442.LP
443.LP
444File: \f2java/applet/package.html\fP
445.LP
446.LP
447.TS
448.if \n+(b.=1 .nr d. \n(.c-\n(c.-1
449.de 35
450.ps \n(.s
451.vs \n(.vu
452.in \n(.iu
453.if \n(.u .fi
454.if \n(.j .ad
455.if \n(.j=0 .na
456..
457.nf
458.nr #~ 0
459.if n .nr #~ 0.6n
460.ds #d .d
461.if \(ts\n(.z\(ts\(ts .ds #d nl
462.fc
463.nr 33 \n(.s
464.rm 80
465.nr 34 \n(.lu
466.eo
467.am 80
468.br
469.di a+
470.35
471.ft \n(.f
472.ll \n(34u*1u/2u
473.if \n(.l<\n(80 .ll \n(80u
474.in 0
475.nf
476\f3
477.fl
478<HTML>
479.fl
480<BODY>
481.fl
482Provides the classes necessary to create an applet and the
483.fl
484classes an applet uses to communicate with its applet context.
485.fl
486<p>
487.fl
488The applet framework involves two entities: the applet
489.fl
490and the applet context. An applet is an embeddable
491.fl
492window (see the {@link java.awt.Panel} class) with a
493.fl
494few extra methods that the applet context can use to
495.fl
496initialize, start, and stop the applet.
497.fl
498
499.fl
500@since 1.0
501.fl
502@see java.awt
503.fl
504</BODY>
505.fl
506</HTML>
507.fl
508\fP
509.fi
510.br
511.di
512.nr a| \n(dn
513.nr a- \n(dl
514..
515.ec \
516.35
517.nf
518.ll \n(34u
519.nr 80 0
520.80
521.rm 80
522.nr 38 \n(a-
523.if \n(80<\n(38 .nr 80 \n(38
524.35
525.nf
526.ll \n(34u
527.nr 38 1n
528.nr 79 0
529.nr 40 \n(79+(0*\n(38)
530.nr 80 +\n(40
531.nr TW \n(80
tbell16c34dd2009-05-04 18:28:26 -0700532.if t .if \n(TW>\n(.li .tm Table at line 406 file Input is too wide - \n(TW units
duke6e45e102007-12-01 00:00:00 +0000533.fc  
534.nr #T 0-1
535.nr #a 0-1
536.eo
537.de T#
538.ds #d .d
539.if \(ts\n(.z\(ts\(ts .ds #d nl
540.mk ##
541.nr ## -1v
542.ls 1
543.ls
544..
545.ec
546.ne \n(a|u+\n(.Vu
547.if (\n(a|+\n(#^-1v)>\n(#- .nr #- +(\n(a|+\n(#^-\n(#--1v)
548.ta \n(80u
549.nr 31 \n(.f
550.nr 35 1m
551\&\h'|\n(40u'
552.mk ##
553.nr 31 \n(##
554.sp |\n(##u-1v
555.nr 37 \n(40u
556.in +\n(37u
557.a+
558.in -\n(37u
559.mk 32
560.if \n(32>\n(31 .nr 31 \n(32
561.sp |\n(31u
562.fc
563.nr T. 1
564.T# 1
565.35
566.rm a+
567.TE
568.if \n-(b.=0 .nr c. \n(.c-\n(d.-40
569
570.LP
571.LP
572Notice this is just a normal HTML file and does not include a package declaration. The content of the package comment file is written in HTML, like all other comments, with one exception: The documentation comment should not include the comment separators \f2/**\fP and \f2*/\fP or leading asterisks. When writing the comment, you should make the first sentence a summary about the package, and not put a title or any other text between \f2<body>\fP and the first sentence. You can include package tags; as with any documentation comment, all block tags must appear after the main description. If you add a \f2@see\fP tag in a package comment file, it must have a fully\-qualified name. For more details, see the
573.na
574\f2example of \fP\f2package.html\fP @
575.fi
576http://java.sun.com/j2se/javadoc/writingdoccomments/index.html#packagecomments.
577.LP
578.LP
579\f3Processing of package comment file\fP \- When the Javadoc tool runs, it will automatically look for the package comment file; if found, the Javadoc tool does the following:
580.LP
581.RS 3
582.TP 2
583o
584Copies the comment for processing. (For \f2package.html\fP, copies all content between \f2<body>\fP and \f2</body>\fP HTML tags. You can include a \f2<head>\fP section to put a \f2<title>\fP, source file copyright statement, or other information, but none of these will appear in the generated documentation.)
585.TP 2
586o
587Processes any package tags that are present.
588.TP 2
589o
tbell16c34dd2009-05-04 18:28:26 -0700590Inserts the processed text at the bottom of the package summary page it generates, as shown in
591.na
592\f2Package Summary\fP @
593.fi
594http://java.sun.com/javase/6/docs/api/java/applet/package\-summary.html.
duke6e45e102007-12-01 00:00:00 +0000595.TP 2
596o
tbell16c34dd2009-05-04 18:28:26 -0700597Copies the first sentence of the package comment to the top of the package summary page. It also adds the package name and this first sentence to the list of packages on the overview page, as shown in
598.na
599\f2Overview Summary\fP @
600.fi
601http://java.sun.com/javase/6/docs/api/overview\-summary.html. The end\-of\-sentence is determined by the same rules used for the end of the first sentence of class and member main descriptions.
duke6e45e102007-12-01 00:00:00 +0000602.RE
603
604.LP
605.SS
606Overview Comment File
607.LP
608.LP
609Each application or set of packages that you are documenting can have its own overview documentation comment, kept in its own "source" file, that the Javadoc tool will merge into the overview page that it generates. You typically include in this comment any documentation that applies to the entire application or set of packages.
610.LP
611.LP
612To create an overview comment file, you can name the file anything you want, typically \f4overview.html\fP and place it anywhere, typically at the top level of the source tree. For example, if the source files for the \f2java.applet\fP package are contained in \f2/home/user/src/java/applet\fP directory, you could create an overview comment file at \f2/home/user/src/overview.html\fP.
613.LP
614.LP
615Notice you can have multiple overview comment files for the same set of source files, in case you want to run javadoc multiple times on different sets of packages. For example, you could run javadoc once with \-private for internal documentation and again without that option for public documentation. In this case, you could describe the documentation as public or internal in the first sentence of each overview comment file.
616.LP
617.LP
618The content of the overview comment file is one big documentation comment, written in HTML, like the package comment file described previously. See that description for details. To re\-iterate, when writing the comment, you should make the first sentence a summary about the application or set of packages, and not put a title or any other text between \f2<body>\fP and the first sentence. You can include overview tags; as with any documentation comment, all tags except in\-line tags, such as \f2{@link}\fP, must appear after the main description. If you add a \f2@see\fP tag, it must have a fully\-qualified name.
619.LP
620.LP
621When you run the Javadoc tool, you specify the overview comment file name with the \-overview option. The file is then processed similar to that of a package comment file.
622.LP
623.RS 3
624.TP 2
625o
626Copies all content between \f2<body>\fP and \f2</body>\fP tags for processing.
627.TP 2
628o
629Processes any overview tags that are present.
630.TP 2
631o
tbell16c34dd2009-05-04 18:28:26 -0700632Inserts the processed text at the bottom of the overview page it generates, as shown in
633.na
634\f2Overview Summary\fP @
635.fi
636http://java.sun.com/javase/6/docs/api/overview\-summary.html.
duke6e45e102007-12-01 00:00:00 +0000637.TP 2
638o
639Copies the first sentence of the overview comment to the top of the overview summary page.
640.RE
641
642.LP
643.SS
644Miscellaneous Unprocessed Files
645.LP
646.LP
647You can also include in your source any miscellaneous files that you want the Javadoc tool to copy to the destination directory. These typically includes graphic files, example Java source (.java) and class (.class) files, and self\-standing HTML files whose content would overwhelm the documentation comment of a normal Java source file.
648.LP
649.LP
650To include unprocessed files, put them in a directory called \f4doc\-files\fP which can be a subdirectory of any package directory that contains source files. You can have one such subdirectory for each package. You might include images, example code, source files, .class files, applets and HTML files. For example, if you want to include the image of a button \f2button.gif\fP in the \f2java.awt.Button\fP class documentation, you place that file in the \f2/home/user/src/java/awt/doc\-files/\fP directory. Notice the \f2doc\-files\fP directory should not be located at \f2/home/user/src/java/doc\-files\fP because \f2java\fP is not a package \-\- that is, it does not directly contain any source files.
651.LP
652.LP
653All links to these unprocessed files must be hard\-coded, because the Javadoc tool does not look at the files \-\- it simply copies the directory and all its contents to the destination. For example, the link in the \f2Button.java\fP doc comment might look like:
654.LP
655.nf
656\f3
657.fl
658 /**
659.fl
660 * This button looks like this:
661.fl
662 * <img src="doc\-files/Button.gif">
663.fl
664 */
665.fl
666\fP
667.fi
668
669.LP
670.SS
671Test Files and Template Files
672.LP
673.LP
674Some developers have indicated they want to store test files and templates files in the source tree near their corresponding source files. That is, they would like to put them in the same directory, or a subdirectory, of those source files.
675.LP
676.LP
677If you run the Javadoc tool by explicitly passing in individual source filenames, you can deliberately omit test and templates files and prevent them from being processed. However, if you are passing in package names or wildcards, you need to follow certain rules to ensure these test files and templates files are not processed.
678.LP
679.LP
680Test files differ from template files in that the former are legal, compilable source files, while the latter are not, but may end with ".java".
681.LP
682.LP
683\f3Test files\fP \- Often developers want to put compilable, runnable test files for a given package in the \f2same\fP directory as the source files for that package. But they want the test files to belong to a package other than the source file package, such as the unnamed package (so the test files have no package statement or a different package statement from the source). In this scenario, when the source is being documented by specifying its package name specified on the command line, the test files will cause warnings or errors. You need to put such test files in a subdirectory. For example, if you want to add test files for source files in \f2com.package1\fP, put them in a subdirectory that would be an invalid package name (because it contains a hyphen):
684.LP
685.nf
686\f3
687.fl
688 com/package1/test\-files/
689.fl
690\fP
691.fi
692
693.LP
694.LP
695The test directory will be skipped by the Javadoc tool with no warnings.
696.LP
697.LP
698If your test files contain doc comments, you can set up a separate run of the Javadoc tool to produce documentation of the test files by passing in their test source filenames with wildcards, such as \f2com/package1/test\-files/*.java\fP.
699.LP
700.LP
701\f3Templates for source files\fP \- Template files have names that often end in ".java" and are not compilable. If you have a template for a source file that you want to keep in the source directory, you can name it with a dash (such as \f2Buffer\-Template.java\fP), or any other illegal Java character, to prevent it from being processed. This relies on the fact that the Javadoc tool will only process source files whose name, when stripped of the ".java" suffix, is actually a legal class name (see
702.na
703\f2Identifiers\fP @
704.fi
705http://java.sun.com/docs/books/jls/second_edition/html/lexical.doc.html#40625).
706.LP
707.SH "GENERATED FILES"
708.LP
709.LP
710By default, javadoc uses a standard doclet that generates HTML\-formatted documentation. This doclet generates the following kinds of files (where each HTML "page" corresponds to a separate file). Note that javadoc generates files with two types of names: those named after classes/interfaces, and those that are not (such as \f2package\-summary.html\fP). Files in the latter group contain hyphens to prevent filename conflicts with those in the former group.
711.LP
712.LP
713\f3Basic Content Pages\fP
714.LP
715.RS 3
716.TP 2
717o
718One \f3class or interface page\fP (\f2classname\fP\f2.html\fP) for each class or interface it is documenting.
719.TP 2
720o
721One \f3package page\fP (\f2package\-summary.html\fP) for each package it is documenting. The Javadoc tool will include any HTML text provided in a file named \f2package.html\fP or \f2package\-info.java\fP in the package directory of the source tree.
722.TP 2
723o
724One \f3overview page\fP (\f2overview\-summary.html\fP) for the entire set of packages. This is the front page of the generated document. The Javadoc tool will include any HTML text provided in a file specified with the \f2\-overview\fP option. Note that this file is created only if you pass into javadoc two or more package names. For further explanation, see HTML Frames.)
725.RE
726
727.LP
728.LP
729\f3Cross\-Reference Pages\fP
730.LP
731.RS 3
732.TP 2
733o
734One \f3class hierarchy page for the entire set of packages\fP (\f2overview\-tree.html\fP). To view this, click on "Overview" in the navigation bar, then click on "Tree".
735.TP 2
736o
737One \f3class hierarchy page for each package\fP (\f2package\-tree.html\fP) To view this, go to a particular package, class or interface page; click "Tree" to display the hierarchy for that package.
738.TP 2
739o
740One \f3"use" page\fP for each package (\f2package\-use.html\fP) and a separate one for each class and interface (\f2class\-use/\fP\f2classname\fP\f2.html\fP). This page describes what packages, classes, methods, constructors and fields use any part of the given class, interface or package. Given a class or interface A, its "use" page includes subclasses of A, fields declared as A, methods that return A, and methods and constructors with parameters of type A. You can access this page by first going to the package, class or interface, then clicking on the "Use" link in the navigation bar.
741.TP 2
742o
743A \f3deprecated API page\fP (\f2deprecated\-list.html\fP) listing all deprecated names. (A deprecated name is not recommended for use, generally due to improvements, and a replacement name is usually given. Deprecated APIs may be removed in future implementations.)
744.TP 2
745o
746A \f3constant field values page\fP (\f2constant\-values.html\fP) for the values of static fields.
747.TP 2
748o
749A \f3serialized form page\fP (\f2serialized\-form.html\fP) for information about serializable and externalizable classes. Each such class has a description of its serialization fields and methods. This information is of interest to re\-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class comment. The standard doclet automatically generates a serialized form page: any class (public or non\-public) that implements Serializable is included, along with \f2readObject\fP and \f2writeObject\fP methods, the fields that are serialized, and the doc comments from the \f2@serial\fP, \f2@serialField\fP, and \f2@serialData\fP tags. Public serializable classes can be excluded by marking them (or their package) with \f2@serial exclude\fP, and package\-private serializable classes can be included by marking them (or their package) with \f2@serial include\fP. As of 1.4, you can generate the complete serialized form for public and private classes by running javadoc \f2without\fP specifying the \f2\-private\fP option.
750.TP 2
751o
752An \f3index\fP (\f2index\-*.html\fP) of all class, interface, constructor, field and method names, alphabetically arranged. This is internationalized for Unicode and can be generated as a single file or as a separate file for each starting character (such as A\-Z for English).
753.RE
754
755.LP
756.LP
757\f3Support Files\fP
758.LP
759.RS 3
760.TP 2
761o
762A \f3help page\fP (\f2help\-doc.html\fP) that describes the navigation bar and the above pages. You can provide your own custom help file to override the default using \f2\-helpfile\fP.
763.TP 2
764o
765One \f3index.html file\fP which creates the HTML frames for display. This is the file you load to display the front page with frames. This file itself contains no text content.
766.TP 2
767o
768Several \f3frame files\fP (\f2*\-frame.html\fP) containing lists of packages, classes and interfaces, used when HTML frames are being displayed.
769.TP 2
770o
771A \f3package list\fP file (\f2package\-list\fP), used by the \f2\-link\fP and \f2\-linkoffline\fP options. This is a text file, not HTML, and is not reachable through any links.
772.TP 2
773o
774A \f3style sheet\fP file (\f2stylesheet.css\fP) that controls a limited amount of color, font family, font size, font style and positioning on the generated pages.
775.TP 2
776o
777A \f3doc\-files\fP directory that holds any image, example, source code or other files that you want copied to the destination directory. These files are not processed by the Javadoc tool in any manner \-\- that is, any javadoc tags in them will be ignored. This directory is not generated unless it exists in the source tree.
778.RE
779
780.LP
781.LP
782\f3HTML Frames\fP
783.LP
784.LP
785The Javadoc tool will generate either two or three HTML frames, as shown in the figure below. It creates the minimum necessary number of frames by omitting the list of packages if there is only one package (or no packages). That is, when you pass a single package name or source files (*.java) belonging to a single package as arguments into the javadoc command, it will create only one frame (C) in the left\-hand column \-\- the list of classes. When you pass into javadoc two or more package names, it creates a third frame (P) listing all packages, as well as an overview page (Detail). This overview page has the filename \f2overview\-summary.html\fP. Thus, this file is created only if you pass in two or more package names. You can bypass frames by clicking on the "No Frames" link or entering at overview\-summary.html.
786.LP
787.LP
788If you are unfamiliar with HTML frames, you should be aware that frames can have \f2focus\fP for printing and scrolling. To give a frame focus, click on it. Then on many browsers the arrow keys and page keys will scroll that frame, and the print menu command will print it.
789.LP
790.nf
791\f3
792.fl
793 \-\-\-\-\-\-\-\-\-\-\-\- \-\-\-\-\-\-\-\-\-\-\-\-
794.fl
795 |C| Detail | |P| Detail |
796.fl
797 | | | | | |
798.fl
799 | | | |\-| |
800.fl
801 | | | |C| |
802.fl
803 | | | | | |
804.fl
805 | | | | | |
806.fl
807 \-\-\-\-\-\-\-\-\-\-\-\- \-\-\-\-\-\-\-\-\-\-\-\-
808.fl
809 javadoc *.java javadoc java.lang java.awt
810.fl
811\fP
812.fi
813
814.LP
815.LP
816Load one of the following two files as the starting page depending on whether you want HTML frames or not:
817.LP
818.RS 3
819.TP 2
820o
821\f2index.html\fP (for frames)
822.TP 2
823o
824\f2overview\-summary.html\fP (for no frames)
825.RE
826
827.LP
828.LP
829\f3Generated File Structure\fP
830.LP
831.LP
832The generated class and interface files are organized in the same directory hierarchy that Java source files and class files are organized. This structure is one directory per subpackage.
833.LP
834.LP
835For example, the document generated for the class \f2java.applet.Applet\fP class would be located at \f2java/applet/Applet.html\fP. The file structure for the java.applet package follows, given that the destination directory is named \f2apidocs\fP. All files that contain the word "frame" appear in the upper\-left or lower\-left frames, as noted. All other HTML files appear in the right\-hand frame.
836.LP
837.RS 3
838
839.LP
840.LP
841NOTE \- Directories are shown in \f3bold\fP. The asterisks (\f2*\fP) indicate the files and directories that are \f2omitted\fP when the arguments to javadoc are source filenames (*.java) rather than package names. Also when arguments are source filenames, \f2package\-list\fP is created but is empty. The doc\-files directory will not be created in the destination unless it exists in the source tree.
842.LP
843.RE
844.nf
845\f3
846.fl
847
848.fl
849\fP\f3apidocs\fP Top directory
850.fl
851 index.html Initial page that sets up HTML frames
852.fl
853 * overview\-summary.html Lists all packages with first sentence summaries
854.fl
855 overview\-tree.html Lists class hierarchy for all packages
856.fl
857 deprecated\-list.html Lists deprecated API for all packages
858.fl
859 constant\-values.html Lists values of static fields for all packages
860.fl
861 serialized\-form.html Lists serialized form for all packages
862.fl
863 * overview\-frame.html Lists all packages, used in upper\-left frame
864.fl
865 allclasses\-frame.html Lists all classes for all packages, used in lower\-left frame
866.fl
867 help\-doc.html Lists user help for how these pages are organized
868.fl
869 index\-all.html Default index created without \-splitindex option
870.fl
871 \f3index\-files\fP Directory created with \-splitindex option
872.fl
873 index\-<number>.html Index files created with \-splitindex option
874.fl
875 package\-list Lists package names, used only for resolving external refs
876.fl
877 stylesheet.css HTML style sheet for defining fonts, colors and positions
878.fl
879 \f3java\fP Package directory
880.fl
881 \f3applet\fP Subpackage directory
882.fl
883 Applet.html Page for Applet class
884.fl
885 AppletContext.html Page for AppletContext interface
886.fl
887 AppletStub.html Page for AppletStub interface
888.fl
889 AudioClip.html Page for AudioClip interface
890.fl
891 * package\-summary.html Lists classes with first sentence summaries for this package
892.fl
893 * package\-frame.html Lists classes in this package, used in lower left\-hand frame
894.fl
895 * package\-tree.html Lists class hierarchy for this package
896.fl
897 package\-use Lists where this package is used
898.fl
899 \f3doc\-files\fP Directory holding image and example files
900.fl
901 \f3class\-use\fP Directory holding pages API is used
902.fl
903 Applet.html Page for uses of Applet class
904.fl
905 AppletContext.html Page for uses of AppletContext interface
906.fl
907 AppletStub.html Page for uses of AppletStub interface
908.fl
909 AudioClip.html Page for uses of AudioClip interface
910.fl
911 \f3src\-html\fP Source code directory
912.fl
913 \f3java\fP Package directory
914.fl
915 \f3applet\fP Subpackage directory
916.fl
917 Applet.html Page for Applet source code
918.fl
919 AppletContext.html Page for AppletContext source code
920.fl
921 AppletStub.html Page for AppletStub source code
922.fl
923 AudioClip.html Page for AudioClip source code
924.fl
925.fi
926
927.LP
928.SS
tbell16c34dd2009-05-04 18:28:26 -0700929Generated API Declarations
duke6e45e102007-12-01 00:00:00 +0000930.LP
931.LP
932The Javadoc tool generates a declaration at the start of each class, interface, field, constructor, and method description for that API item. For example, the declaration for the \f2Boolean\fP class is:
933.LP
934.LP
935\f2public final class Boolean\fP
936.br
937\f2extends Object\fP
938.br
939\f2implements Serializable\fP
940.LP
941.LP
942and the declaration for the \f2Boolean.valueOf\fPmethod is:
943.LP
944.LP
945\f2public static Boolean valueOf(String s)\fP
946.LP
947.LP
948The Javadoc tool can include the modifiers \f2public\fP, \f2protected\fP, \f2private\fP, \f2abstract\fP, \f2final\fP, \f2static\fP, \f2transient\fP, and \f2volatile\fP, but not \f2synchronized\fP or \f2native\fP. These last two modifiers are considered implementation detail and not part of the API specification.
949.LP
950.LP
951Rather than relying on the keyword \f2synchronized\fP, APIs should document their concurrency semantics in the comment's main description, as in "a single \f2Enumeration\fP cannot be used by multiple threads concurrently". The document should not describe how to achieve these semantics. As another example, while \f2Hashtable\fP should be thread\-safe, there's no reason to specify that we achieve this by synchronizing all of its exported methods. We should reserve the right to synchronize internally at the bucket level, thus offering higher concurrency.
952.LP
953.SH "DOCUMENTATION COMMENTS"
954.LP
955.LP
956The original "Documentation Comment Specification" can be found under related documentation.
957.LP
958.SS
959Commenting the Source Code
960.LP
961.LP
962You can include \f2documentation comments\fP ("doc comments") in the source code, ahead of declarations for any class, interface, method, constructor, or field. You can also create doc comments for each package and another one for the overview, though their syntax is slightly different. Doc comments are also known informally as "Javadoc comments" (but this term violates its trademark usage). A doc comment consists of the characters between the characters \f2/**\fP that begin the comment and the characters \f2*/\fP that end it. Leading asterisks are allowed on each line and are described further below. The text in a comment can continue onto multiple lines.
963.LP
964.nf
965\f3
966.fl
967/**
968.fl
969 * This is the typical format of a simple documentation comment
970.fl
971 * that spans two lines.
972.fl
973 */
974.fl
975\fP
976.fi
977
978.LP
979.LP
980To save space you can put a comment on one line:
981.LP
982.nf
983\f3
984.fl
985/** This comment takes up only one line. */
986.fl
987\fP
988.fi
989
990.LP
991.LP
992\f3Placement of comments\fP \- Documentation comments are recognized only when placed immediately before class, interface, constructor, method, or field declarations \-\- see the class example, method example, and field example. Documentation comments placed in the body of a method are ignored. Only one documentation comment per declaration statement is recognized by the Javadoc tool.
993.LP
994.LP
995A common mistake is to put an \f2import\fP statement between the class comment and the class declaration. Avoid this, as the Javadoc tool will ignore the class comment.
996.LP
997.nf
998\f3
999.fl
1000 /**
1001.fl
1002 * This is the class comment for the class Whatever.
1003.fl
1004 */
1005.fl
1006
1007.fl
1008 import com.sun; // MISTAKE \- Important not to put import statement here
1009.fl
1010
1011.fl
1012 public class Whatever {
1013.fl
1014 }
1015.fl
1016\fP
1017.fi
1018
1019.LP
1020.LP
1021\f3A doc comment is composed of a \fP\f4main description\fP\f3 followed by a \fP\f4tag section\fP \- The \f2main description\fP begins after the starting delimiter \f2/**\fP and continues until the tag section. The \f2tag section\fP starts with the first block tag, which is defined by the first \f2@\fP character that begins a line (ignoring leading asterisks, white space, and leading separator \f2/**\fP). It is possible to have a comment with only a tag section and no main description. The main description cannot continue after the tag section begins. The argument to a tag can span multiple lines. There can be any number of tags \-\- some types of tags can be repeated while others cannot. For example, this \f2@see\fP starts the tag section:
1022.LP
1023.nf
1024\f3
1025.fl
1026/**
1027.fl
1028 * This sentence would hold the main description for this doc comment.
1029.fl
1030 * @see java.lang.Object
1031.fl
1032 */
1033.fl
1034\fP
1035.fi
1036
1037.LP
1038.LP
1039\f3Block tags and in\-line tags\fP \- A \f2tag\fP is a special keyword within a doc comment that the Javadoc tool can process. There are two kinds of tags: block tags, which appear as \f2@tag\fP (also known as "standalone tags"), and in\-line tags, which appear within curly braces, as \f2{@tag}\fP. To be interpreted, a block tag must appear at the beginning of a line, ignoring leading asterisks, white space, and separator (\f2/**\fP). This means you can use the \f2@\fP character elsewhere in the text and it will not be interpreted as the start of a tag. If you want to start a line with the \f2@\fP character and not have it be interpreted, use the HTML entity \f2&#064;\fP. Each block tag has associated text, which includes any text following the tag up to, but not including, either the next tag, or the end of the doc comment. This associated text can span multiple lines. An in\-line tag is allowed and interpreted anywhere that text is allowed. The following example contains the block tag \f2@deprecated\fP and in\-line tag \f2{@link}\fP.
1040.LP
1041.nf
1042\f3
1043.fl
1044/**
1045.fl
1046 * @deprecated As of JDK 1.1, replaced by {@link #setBounds(int,int,int,int)}
1047.fl
1048 */
1049.fl
1050\fP
1051.fi
1052
1053.LP
1054.LP
1055\f3Comments are written in HTML\fP \- The text must be written in HTML, in that they should use HTML entities and can use HTML tags. You can use whichever version of HTML your browser supports; we have written the standard doclet to generate HTML 3.2\-compliant code elsewhere (outside of the documentation comments) with the inclusion of cascading style sheets and frames. (We preface each generated file with "HTML 4.0" because of the frame sets.)
1056.LP
1057.LP
1058For example, entities for the less\-than (\f2<\fP) and greater\-than (\f2>\fP) symbols should be written \f2<\fP and \f2>\fP. Likewise, the ampersand (\f2&\fP) should be written \f2&\fP. The bold HTML tag \f2<b>\fP is shown in the following example.
1059.LP
1060.LP
1061Here is a doc comment:
1062.LP
1063.nf
1064\f3
1065.fl
1066/**
1067.fl
1068 * This is a <b>doc</b> comment.
1069.fl
1070 * @see java.lang.Object
1071.fl
1072 */
1073.fl
1074\fP
1075.fi
1076
1077.LP
1078.LP
1079\f3Leading asterisks\fP \- When javadoc parses a doc comment, leading asterisk (\f2*\fP) characters on each line are discarded; blanks and tabs preceding the initial asterisk (\f2*\fP) characters are also discarded. Starting with 1.4, if you omit the leading asterisk on a line, the leading white space is no longer removed. This enables you to paste code examples directly into a doc comment inside a \f2<PRE>\fP tag, and its indentation will be honored. Spaces are generally interpreted by browsers more uniformly than tabs. Indentation is relative to the left margin (rather than the separator \f2/**\fP or \f2<PRE>\fP tag).
1080.LP
1081.LP
1082\f3First sentence\fP \- The first sentence of each doc comment should be a summary sentence, containing a concise but complete description of the declared entity. This sentence ends at the first period that is followed by a blank, tab, or line terminator, or at the first block tag. The Javadoc tool copies this first sentence to the member summary at the top of the HTML page.
1083.LP
1084.LP
1085\f3Declaration with multiple fields\fP \- Java allows declaring multiple fields in a single statement, but this statement can have only one documentation comment, which is copied for all fields. Therefore if you want individual documentation comments for each field, you must declare each field in a separate statement. For example, the following documentation comment doesn't make sense written as a single declaration and would be better handled as two declarations:
1086.LP
1087.RS 3
1088
1089.LP
1090.nf
1091\f3
1092.fl
1093/**
1094.fl
1095 * The horizontal and vertical distances of point (x,y)
1096.fl
1097 */
1098.fl
1099public int x, y; // Avoid this
1100.fl
1101\fP
1102.fi
1103.RE
1104
1105.LP
1106.LP
1107The Javadoc tool generates the following documentation from the above code:
1108.LP
1109.RS 3
1110
1111.LP
1112.nf
1113\f3
1114.fl
1115public int \fP\f3x\fP
1116.fl
1117.fi
1118
1119.LP
1120.RS 3
1121The horizontal and vertical distances of point (x,y)
1122.RE
1123
1124.LP
1125.nf
1126\f3
1127.fl
1128public int \fP\f3y\fP
1129.fl
1130.fi
1131
1132.LP
1133.RS 3
1134The horizontal and vertical distances of point (x,y)
1135.RE
1136
1137.LP
1138.RE
1139.LP
1140\f3Use header tags carefully\fP \- When writing documentation comments for members, it's best not to use HTML heading tags such as <H1> and <H2>, because the Javadoc tool creates an entire structured document and these structural tags might interfere with the formatting of the generated document. However, it is fine to use these headings in class and package comments to provide your own structure.
1141.LP
1142.SS
1143Automatic Copying of Method Comments
1144.LP
1145.LP
1146The Javadoc tool has the ability to copy or "inherit" method comments in classes and interfaces under the following two circumstances. Constructors, fields and nested classes do not inherit doc comments.
1147.LP
1148.RS 3
1149.TP 2
1150o
1151\f3Automatically inherit comment to fill in missing text\fP \- When a main description, or \f2@return\fP, \f2@param\fP or \f2@throws\fP tag is missing from a method comment, the Javadoc tool copies the corresponding main description or tag comment from the method it overrides or implements (if any), according to the algorithm below.
1152.LP
1153More specifically, when a \f2@param\fP tag for a particular parameter is missing, then the comment for that parameter is copied from the method further up the inheritance hierarchy. When a \f2@throws\fP tag for a particular exception is missing, the \f2@throws\fP tag is copied \f2only if that exception is declared\fP.
1154.LP
1155This behavior contrasts with version 1.3 and earlier, where the presence of any main description or tag would prevent all comments from being inherited.
1156.TP 2
1157o
1158\f3Explicitly inherit comment with {@inheritDoc} tag\fP \- Insert the inline tag \f2{@inheritDoc}\fP in a method main description or \f2@return\fP, \f2@param\fP or \f2@throws\fP tag comment \-\- the corresponding inherited main description or tag comment is copied into that spot.
1159.RE
1160
1161.LP
1162.LP
1163The source file for the inherited method need only be on the path specified by \-sourcepath for the doc comment to actually be available to copy. Neither the class nor its package needs to be passed in on the command line. This contrasts with 1.3.x and earlier releases, where the class had to be a documented class
1164.LP
1165.LP
1166\f3Inherit from classes and interfaces\fP \- Inheriting of comments occurs in all three possible cases of inheritance from classes and interfaces:
1167.LP
1168.RS 3
1169.TP 2
1170o
1171When a method in a class overrides a method in a superclass
1172.TP 2
1173o
1174When a method in an interface overrides a method in a superinterface
1175.TP 2
1176o
1177When a method in a class implements a method in an interface
1178.RE
1179
1180.LP
1181.LP
1182In the first two cases, for method overrides, the Javadoc tool generates a subheading "Overrides" in the documentation for the overriding method, with a link to the method it is overriding, whether or not the comment is inherited.
1183.LP
1184.LP
1185In the third case, when a method in a given class implements a method in an interface, the Javadoc tool generates a subheading "Specified by" in the documentation for the overriding method, with a link to the method it is implementing. This happens whether or not the comment is inherited.
1186.LP
1187.LP
1188\f3Algorithm for Inheriting Method Comments\fP \- If a method does not have a doc comment, or has an {@inheritDoc} tag, the Javadoc tool searches for an applicable comment using the following algorithm, which is designed to find the most specific applicable doc comment, giving preference to interfaces over superclasses:
1189.LP
1190.RS 3
1191.TP 3
11921.
1193Look in each directly implemented (or extended) interface in the order they appear following the word implements (or extends) in the method declaration. Use the first doc comment found for this method.
1194.TP 3
11952.
1196If step 1 failed to find a doc comment, recursively apply this entire algorithm to each directly implemented (or extended) interface, in the same order they were examined in step 1.
1197.TP 3
11983.
1199If step 2 failed to find a doc comment and this is a class other than Object (not an interface):
1200.RS 3
1201.TP 3
1202a.
1203If the superclass has a doc comment for this method, use it.
1204.TP 3
1205b.
1206If step 3a failed to find a doc comment, recursively apply this entire algorithm to the superclass.
1207.RE
1208.RE
1209
1210.LP
1211.SH "JAVADOC TAGS"
1212.LP
1213.LP
1214The Javadoc tool parses special tags when they are embedded within a Java doc comment. These doc tags enable you to autogenerate a complete, well\-formatted API from your source code. The tags start with an "at" sign (\f2@\fP) and are case\-sensitive \-\- they must be typed with the uppercase and lowercase letters as shown. A tag must start at the beginning of a line (after any leading spaces and an optional asterisk) or it is treated as normal text. By convention, tags with the same name are grouped together. For example, put all \f2@see\fP tags together.
1215.LP
1216.LP
1217Tags come in two types:
1218.LP
1219.RS 3
1220.TP 2
1221o
1222\f3Block tags\fP \- Can be placed only in the tag section that follows the main description. Block tags are of the form: \f2@tag\fP.
1223.TP 2
1224o
1225\f3Inline tags\fP \- Can be placed anywhere in the main description or in the comments for block tags. Inline tags are denoted by curly braces: \f2{@tag}\fP.
1226.RE
1227
1228.LP
1229.LP
1230For information about tags we might introduce in future releases, see
1231.na
1232\f2Proposed Tags\fP @
1233.fi
1234http://java.sun.com/j2se/javadoc/proposed\-tags.html.
1235.LP
1236.LP
1237The current tags are:
1238.LP
1239.RS 3
1240
1241.LP
1242.LP
1243.TS
1244.if \n+(b.=1 .nr d. \n(.c-\n(c.-1
1245.de 35
1246.ps \n(.s
1247.vs \n(.vu
1248.in \n(.iu
1249.if \n(.u .fi
1250.if \n(.j .ad
1251.if \n(.j=0 .na
1252..
1253.nf
1254.nr #~ 0
1255.if n .nr #~ 0.6n
1256.ds #d .d
1257.if \(ts\n(.z\(ts\(ts .ds #d nl
1258.fc
1259.nr 33 \n(.s
1260.rm 80 81
1261.nr 80 0
1262.nr 38 \w\f3Tag\fP
1263.if \n(80<\n(38 .nr 80 \n(38
1264.nr 38 \w\f2@author\fP
1265.if \n(80<\n(38 .nr 80 \n(38
1266.nr 38 \w\f2{@code}\fP
1267.if \n(80<\n(38 .nr 80 \n(38
1268.nr 38 \w\f2{@docRoot}\fP
1269.if \n(80<\n(38 .nr 80 \n(38
1270.nr 38 \w\f2@deprecated\fP
1271.if \n(80<\n(38 .nr 80 \n(38
1272.nr 38 \w\f2@exception\fP
1273.if \n(80<\n(38 .nr 80 \n(38
1274.nr 38 \w\f2{@inheritDoc}\fP
1275.if \n(80<\n(38 .nr 80 \n(38
1276.nr 38 \w\f2{@link}\fP
1277.if \n(80<\n(38 .nr 80 \n(38
1278.nr 38 \w\f2{@linkplain}\fP
1279.if \n(80<\n(38 .nr 80 \n(38
1280.nr 38 \w\f2{@literal}\fP
1281.if \n(80<\n(38 .nr 80 \n(38
1282.nr 38 \w\f2@param\fP
1283.if \n(80<\n(38 .nr 80 \n(38
1284.nr 38 \w\f2@return\fP
1285.if \n(80<\n(38 .nr 80 \n(38
1286.nr 38 \w\f2@see\fP
1287.if \n(80<\n(38 .nr 80 \n(38
1288.nr 38 \w\f2@serial\fP
1289.if \n(80<\n(38 .nr 80 \n(38
1290.nr 38 \w\f2@serialData\fP
1291.if \n(80<\n(38 .nr 80 \n(38
1292.nr 38 \w\f2@serialField\fP
1293.if \n(80<\n(38 .nr 80 \n(38
1294.nr 38 \w\f2@since\fP
1295.if \n(80<\n(38 .nr 80 \n(38
1296.nr 38 \w\f2@throws\fP
1297.if \n(80<\n(38 .nr 80 \n(38
1298.nr 38 \w\f2{@value}\fP
1299.if \n(80<\n(38 .nr 80 \n(38
1300.nr 38 \w\f2@version\fP
1301.if \n(80<\n(38 .nr 80 \n(38
1302.80
1303.rm 80
1304.nr 81 0
1305.nr 38 \w\f3Introduced in JDK/SDK\fP
1306.if \n(81<\n(38 .nr 81 \n(38
1307.nr 38 \w1.0
1308.if \n(81<\n(38 .nr 81 \n(38
1309.nr 38 \w1.5
1310.if \n(81<\n(38 .nr 81 \n(38
1311.nr 38 \w1.3
1312.if \n(81<\n(38 .nr 81 \n(38
1313.nr 38 \w1.0
1314.if \n(81<\n(38 .nr 81 \n(38
1315.nr 38 \w1.0
1316.if \n(81<\n(38 .nr 81 \n(38
1317.nr 38 \w1.4
1318.if \n(81<\n(38 .nr 81 \n(38
1319.nr 38 \w1.2
1320.if \n(81<\n(38 .nr 81 \n(38
1321.nr 38 \w1.4
1322.if \n(81<\n(38 .nr 81 \n(38
1323.nr 38 \w1.5
1324.if \n(81<\n(38 .nr 81 \n(38
1325.nr 38 \w1.0
1326.if \n(81<\n(38 .nr 81 \n(38
1327.nr 38 \w1.0
1328.if \n(81<\n(38 .nr 81 \n(38
1329.nr 38 \w1.0
1330.if \n(81<\n(38 .nr 81 \n(38
1331.nr 38 \w1.2
1332.if \n(81<\n(38 .nr 81 \n(38
1333.nr 38 \w1.2
1334.if \n(81<\n(38 .nr 81 \n(38
1335.nr 38 \w1.2
1336.if \n(81<\n(38 .nr 81 \n(38
1337.nr 38 \w1.1
1338.if \n(81<\n(38 .nr 81 \n(38
1339.nr 38 \w1.2
1340.if \n(81<\n(38 .nr 81 \n(38
1341.nr 38 \w1.4
1342.if \n(81<\n(38 .nr 81 \n(38
1343.nr 38 \w1.0
1344.if \n(81<\n(38 .nr 81 \n(38
1345.81
1346.rm 81
1347.nr 38 1n
1348.nr 79 0
1349.nr 40 \n(79+(0*\n(38)
1350.nr 80 +\n(40
1351.nr 41 \n(80+(3*\n(38)
1352.nr 81 +\n(41
1353.nr TW \n(81
tbell16c34dd2009-05-04 18:28:26 -07001354.if t .if \n(TW>\n(.li .tm Table at line 1123 file Input is too wide - \n(TW units
duke6e45e102007-12-01 00:00:00 +00001355.fc  
1356.nr #T 0-1
1357.nr #a 0-1
1358.eo
1359.de T#
1360.ds #d .d
1361.if \(ts\n(.z\(ts\(ts .ds #d nl
1362.mk ##
1363.nr ## -1v
1364.ls 1
1365.ls
1366..
1367.ec
1368.ta \n(80u \n(81u
1369.nr 31 \n(.f
1370.nr 35 1m
1371\&\h'|\n(40u'\f3Tag\fP\h'|\n(41u'\f3Introduced in JDK/SDK\fP
1372.ta \n(80u \n(81u
1373.nr 31 \n(.f
1374.nr 35 1m
1375\&\h'|\n(40u'\f2@author\fP\h'|\n(41u'1.0
1376.ta \n(80u \n(81u
1377.nr 31 \n(.f
1378.nr 35 1m
1379\&\h'|\n(40u'\f2{@code}\fP\h'|\n(41u'1.5
1380.ta \n(80u \n(81u
1381.nr 31 \n(.f
1382.nr 35 1m
1383\&\h'|\n(40u'\f2{@docRoot}\fP\h'|\n(41u'1.3
1384.ta \n(80u \n(81u
1385.nr 31 \n(.f
1386.nr 35 1m
1387\&\h'|\n(40u'\f2@deprecated\fP\h'|\n(41u'1.0
1388.ta \n(80u \n(81u
1389.nr 31 \n(.f
1390.nr 35 1m
1391\&\h'|\n(40u'\f2@exception\fP\h'|\n(41u'1.0
1392.ta \n(80u \n(81u
1393.nr 31 \n(.f
1394.nr 35 1m
1395\&\h'|\n(40u'\f2{@inheritDoc}\fP\h'|\n(41u'1.4
1396.ta \n(80u \n(81u
1397.nr 31 \n(.f
1398.nr 35 1m
1399\&\h'|\n(40u'\f2{@link}\fP\h'|\n(41u'1.2
1400.ta \n(80u \n(81u
1401.nr 31 \n(.f
1402.nr 35 1m
1403\&\h'|\n(40u'\f2{@linkplain}\fP\h'|\n(41u'1.4
1404.ta \n(80u \n(81u
1405.nr 31 \n(.f
1406.nr 35 1m
1407\&\h'|\n(40u'\f2{@literal}\fP\h'|\n(41u'1.5
1408.ta \n(80u \n(81u
1409.nr 31 \n(.f
1410.nr 35 1m
1411\&\h'|\n(40u'\f2@param\fP\h'|\n(41u'1.0
1412.ta \n(80u \n(81u
1413.nr 31 \n(.f
1414.nr 35 1m
1415\&\h'|\n(40u'\f2@return\fP\h'|\n(41u'1.0
1416.ta \n(80u \n(81u
1417.nr 31 \n(.f
1418.nr 35 1m
1419\&\h'|\n(40u'\f2@see\fP\h'|\n(41u'1.0
1420.ta \n(80u \n(81u
1421.nr 31 \n(.f
1422.nr 35 1m
1423\&\h'|\n(40u'\f2@serial\fP\h'|\n(41u'1.2
1424.ta \n(80u \n(81u
1425.nr 31 \n(.f
1426.nr 35 1m
1427\&\h'|\n(40u'\f2@serialData\fP\h'|\n(41u'1.2
1428.ta \n(80u \n(81u
1429.nr 31 \n(.f
1430.nr 35 1m
1431\&\h'|\n(40u'\f2@serialField\fP\h'|\n(41u'1.2
1432.ta \n(80u \n(81u
1433.nr 31 \n(.f
1434.nr 35 1m
1435\&\h'|\n(40u'\f2@since\fP\h'|\n(41u'1.1
1436.ta \n(80u \n(81u
1437.nr 31 \n(.f
1438.nr 35 1m
1439\&\h'|\n(40u'\f2@throws\fP\h'|\n(41u'1.2
1440.ta \n(80u \n(81u
1441.nr 31 \n(.f
1442.nr 35 1m
1443\&\h'|\n(40u'\f2{@value}\fP\h'|\n(41u'1.4
1444.ta \n(80u \n(81u
1445.nr 31 \n(.f
1446.nr 35 1m
1447\&\h'|\n(40u'\f2@version\fP\h'|\n(41u'1.0
1448.fc
1449.nr T. 1
1450.T# 1
1451.35
1452.TE
1453.if \n-(b.=0 .nr c. \n(.c-\n(d.-42
1454
1455.LP
1456.LP
1457For custom tags, see the \-tag option.
1458.LP
1459.RE
1460.RS 3
1461.TP 3
1462@author\ name\-text
1463Adds an "Author" entry with the specified \f2name\-text\fP to the generated docs when the \-author option is used. A doc comment may contain multiple \f2@author\fP tags. You can specify one name per \f2@author\fP tag or multiple names per tag. In the former case, the Javadoc tool inserts a comma (\f2,\fP) and space between names. In the latter case, the entire text is simply copied to the generated document without being parsed. Therefore, you can use multiple names per line if you want a localized name separator other than comma.
1464.LP
1465For more details, see Where Tags Can Be Used and
1466.na
1467\f2writing @author tags\fP @
1468.fi
1469http://java.sun.com/j2se/javadoc/writingdoccomments/index.html#@author.
1470.LP
1471.TP 3
1472@deprecated\ deprecated\-text
1473.RS 3
1474
1475.LP
1476.LP
tbell16c34dd2009-05-04 18:28:26 -07001477Note: You can deprecate a program element using the
1478.na
1479\f2@Deprecated annotation\fP @
1480.fi
1481http://java.sun.com/javase/6/docs/technotes/guides/javadoc/deprecation/deprecation.html.
duke6e45e102007-12-01 00:00:00 +00001482.LP
1483.RE
tbell16c34dd2009-05-04 18:28:26 -07001484.RE
1485.RS 3
1486
duke6e45e102007-12-01 00:00:00 +00001487.LP
duke6e45e102007-12-01 00:00:00 +00001488.LP
tbell16c34dd2009-05-04 18:28:26 -07001489Adds a comment indicating that this API should no longer be used (even though it may continue to work). The Javadoc tool moves the \f2deprecated\-text\fP ahead of the main description, placing it in italics and preceding it with a bold warning: "Deprecated". This tag is valid in all doc comments: overview, package, class, interface, constructor, method and field.
1490.LP
1491.LP
1492The first sentence of \f2deprecated\-text\fP should at least tell the user when the API was deprecated and what to use as a replacement. The Javadoc tool copies just the first sentence to the summary section and index. Subsequent sentences can also explain why it has been deprecated. You should include a \f2{@link}\fP tag (for Javadoc 1.2 or later) that points to the replacement API:
1493.LP
duke6e45e102007-12-01 00:00:00 +00001494.LP
1495For more details, see
1496.na
1497\f2writing @deprecated tags\fP @
1498.fi
tbell16c34dd2009-05-04 18:28:26 -07001499http://java.sun.com/j2se/javadoc/writingdoccomments/index.html#@deprecated.
1500.LP
duke6e45e102007-12-01 00:00:00 +00001501.RS 3
1502.TP 2
1503o
1504For Javadoc 1.2 and later, use a \f2{@link}\fP tag. This creates the link in\-line, where you want it. For example:
1505.nf
1506\f3
1507.fl
1508/**
1509.fl
1510 * @deprecated As of JDK 1.1, replaced by {@link #setBounds(int,int,int,int)}
1511.fl
1512 */
1513.fl
tbell16c34dd2009-05-04 18:28:26 -07001514
1515.fl
duke6e45e102007-12-01 00:00:00 +00001516\fP
1517.fi
1518.TP 2
1519o
1520For Javadoc 1.1, the standard format is to create a \f2@see\fP tag (which cannot be in\-line) for each \f2@deprecated\fP tag.
1521.RE
tbell16c34dd2009-05-04 18:28:26 -07001522
duke6e45e102007-12-01 00:00:00 +00001523.LP
duke6e45e102007-12-01 00:00:00 +00001524.LP
tbell16c34dd2009-05-04 18:28:26 -07001525For more about deprecation, see
1526.na
1527\f2The @deprecated tag\fP @
1528.fi
1529http://java.sun.com/javase/6/docs/technotes/guides/javadoc/deprecation/index.html.
1530.LP
1531.LP
1532
1533.LP
1534.RE
1535.RS 3
duke6e45e102007-12-01 00:00:00 +00001536.TP 3
1537{@code\ text}
1538Equivalent to \f2<code>{@literal}</code>\fP.
1539.LP
1540Displays \f2text\fP in \f2code\fP font without interpreting the text as HTML markup or nested javadoc tags. This enables you to use regular angle brackets (\f2<\fP and \f2>\fP) instead of the HTML entities (\f2<\fP and \f2>\fP) in doc comments, such as in parameter types (\f2<Object>\fP), inequalities (\f23 < 4\fP), or arrows (\f2<\-\fP). For example, the doc comment text:
1541.nf
1542\f3
1543.fl
1544 \fP\f4{@code A<B>C}\fP\f3
1545.fl
tbell16c34dd2009-05-04 18:28:26 -07001546
1547.fl
duke6e45e102007-12-01 00:00:00 +00001548\fP
1549.fi
tbell16c34dd2009-05-04 18:28:26 -07001550.LP
duke6e45e102007-12-01 00:00:00 +00001551displays in the generated HTML page unchanged, as:
1552.nf
1553\f3
1554.fl
1555 \fP\f4A<B>C\fP\f3
1556.fl
tbell16c34dd2009-05-04 18:28:26 -07001557
1558.fl
duke6e45e102007-12-01 00:00:00 +00001559\fP
1560.fi
tbell16c34dd2009-05-04 18:28:26 -07001561.LP
duke6e45e102007-12-01 00:00:00 +00001562The noteworthy point is that the \f2<B>\fP is not interpreted as bold and is in code font.
1563.LP
1564If you want the same functionality without the code font, use \f2{@literal}\fP.
1565.LP
1566.TP 3
1567{@docRoot}
1568Represents the relative path to the generated document's (destination) root directory from any generated page. It is useful when you want to include a file, such as a copyright page or company logo, that you want to reference from all generated pages. Linking to the copyright page from the bottom of each page is common.
1569.LP
1570This \f2{@docRoot}\fP tag can be used both on the command line and in a doc comment: This tag is valid in all doc comments: overview, package, class, interface, constructor, method and field, including the text portion of any tag (such as @return, @param and @deprecated).
1571.RS 3
1572.TP 3
15731.
1574On the command line, where the header/footer/bottom are defined:
1575.nf
1576\f3
1577.fl
1578 javadoc \-bottom '<a href="{@docRoot}/copyright.html">Copyright</a>'
1579.fl
tbell16c34dd2009-05-04 18:28:26 -07001580
1581.fl
duke6e45e102007-12-01 00:00:00 +00001582\fP
1583.fi
tbell16c34dd2009-05-04 18:28:26 -07001584.LP
1585NOTE \- When using \f2{@docRoot}\fP this way in a make file, some makefile programs require special escaping for the brace {} characters. For example, the Inprise MAKE version 5.2 running on Windows requires double braces: \f2{{@docRoot}}\fP. It also requires double (rather than single) quotes to enclose arguments to options such as \f2\-bottom\fP (with the quotes around the \f2href\fP argument omitted).
duke6e45e102007-12-01 00:00:00 +00001586.TP 3
15872.
1588In a doc comment:
1589.nf
1590\f3
1591.fl
1592 /**
1593.fl
1594 * See the <a href="{@docRoot}/copyright.html">Copyright</a>.
1595.fl
1596 */
1597.fl
tbell16c34dd2009-05-04 18:28:26 -07001598
1599.fl
duke6e45e102007-12-01 00:00:00 +00001600\fP
1601.fi
1602.RE
tbell16c34dd2009-05-04 18:28:26 -07001603.LP
duke6e45e102007-12-01 00:00:00 +00001604The reason this tag is needed is because the generated docs are in hierarchical directories, as deep as the number of subpackages. This expression:
1605.nf
1606\f3
1607.fl
1608 <a href="{@docRoot}/copyright.html">
1609.fl
tbell16c34dd2009-05-04 18:28:26 -07001610
1611.fl
duke6e45e102007-12-01 00:00:00 +00001612\fP
1613.fi
tbell16c34dd2009-05-04 18:28:26 -07001614.LP
duke6e45e102007-12-01 00:00:00 +00001615would resolve to:
1616.nf
1617\f3
1618.fl
1619 <a href="../../copyright.html"> for java/lang/Object.java
1620.fl
tbell16c34dd2009-05-04 18:28:26 -07001621
1622.fl
duke6e45e102007-12-01 00:00:00 +00001623\fP
1624.fi
tbell16c34dd2009-05-04 18:28:26 -07001625.LP
duke6e45e102007-12-01 00:00:00 +00001626and
1627.nf
1628\f3
1629.fl
1630 <a href="../../../copyright.html"> for java/lang/ref/Reference.java
1631.fl
tbell16c34dd2009-05-04 18:28:26 -07001632
1633.fl
duke6e45e102007-12-01 00:00:00 +00001634\fP
1635.fi
1636.LP
1637.TP 3
1638@exception\ class\-name\ description
1639The \f2@exception\fP tag is a synonym for \f2@throws\fP.
1640.LP
1641.TP 3
1642{@inheritDoc}\
1643Inherits (copies) documentation from the "nearest" inheritable class or implementable interface into the current doc comment at this tag's location. This allows you to write more general comments higher up the inheritance tree, and to write around the copied text.
1644.LP
1645This tag is valid only in these places in a doc comment:
1646.RS 3
1647.TP 2
1648o
1649In the main description block of a method. In this case, the main description is copied from a class or interface up the hierarchy.
1650.TP 2
1651o
1652In the text arguments of the @return, @param and @throws tags of a method. In this case, the tag text is copied from the corresponding tag up the hierarchy.
1653.RE
1654.LP
1655See Automatic Copying of Method Comments for a more precise description of how comments are found in the inheritance hierarchy. Note that if this tag is missing, the comment is or is not automatically inherited according to rules described in that section.
1656.LP
1657.TP 3
1658{@link\ package.class#member\ label}
1659Inserts an in\-line link with visible text \f2label\fP that points to the documentation for the specified package, class or member name of a referenced class. This tag is valid in all doc comments: overview, package, class, interface, constructor, method and field, including the text portion of any tag (such as @return, @param and @deprecated).
1660.LP
1661This tag is very simliar to \f2@see\fP \-\- both require the same references and accept exactly the same syntax for \f2package.class\fP\f2#\fP\f2member\fP and \f2label\fP. The main difference is that \f2{@link}\fP generates an in\-line link rather than placing the link in the "See Also" section. Also, the \f2{@link}\fP tag begins and ends with curly braces to separate it from the rest of the in\-line text. If you need to use "}" inside the label, use the HTML entity notation &#125;
1662.LP
1663There is no limit to the number of \f2{@link}\fP tags allowed in a sentence. You can use this tag in the main description part of any documentation comment or in the text portion of any tag (such as @deprecated, @return or @param).
1664.LP
1665For example, here is a comment that refers to the \f2getComponentAt(int, int)\fP method:
1666.nf
1667\f3
1668.fl
1669Use the {@link #getComponentAt(int, int) getComponentAt} method.
1670.fl
tbell16c34dd2009-05-04 18:28:26 -07001671
1672.fl
duke6e45e102007-12-01 00:00:00 +00001673\fP
1674.fi
tbell16c34dd2009-05-04 18:28:26 -07001675.LP
duke6e45e102007-12-01 00:00:00 +00001676From this, the standard doclet would generate the following HTML (assuming it refers to another class in the same package):
1677.nf
1678\f3
1679.fl
1680Use the <a href="Component.html#getComponentAt(int, int)">getComponentAt</a> method.
1681.fl
tbell16c34dd2009-05-04 18:28:26 -07001682
1683.fl
duke6e45e102007-12-01 00:00:00 +00001684\fP
1685.fi
tbell16c34dd2009-05-04 18:28:26 -07001686.LP
duke6e45e102007-12-01 00:00:00 +00001687Which appears on the web page as:
1688.nf
1689\f3
1690.fl
1691Use the getComponentAt method.
1692.fl
tbell16c34dd2009-05-04 18:28:26 -07001693
1694.fl
duke6e45e102007-12-01 00:00:00 +00001695\fP
1696.fi
tbell16c34dd2009-05-04 18:28:26 -07001697.LP
duke6e45e102007-12-01 00:00:00 +00001698You can extend \f2{@link}\fP to link to classes not being documented by using the \f2\-link\fP option.
1699.LP
1700For more details, see
1701.na
1702\f2writing {@link} tags\fP @
1703.fi
1704http://java.sun.com/j2se/javadoc/writingdoccomments/index.html#{@link}.
1705.LP
1706.TP 3
1707{@linkplain\ package.class#member\ label}
1708Identical to \f2{@link}\fP, except the link's label is displayed in plain text than code font. Useful when the label is plain text. Example:
1709.nf
1710\f3
1711.fl
1712 Refer to {@linkplain add() the overridden method}.
1713.fl
tbell16c34dd2009-05-04 18:28:26 -07001714
1715.fl
duke6e45e102007-12-01 00:00:00 +00001716\fP
1717.fi
tbell16c34dd2009-05-04 18:28:26 -07001718.LP
duke6e45e102007-12-01 00:00:00 +00001719This would display as:
1720.RS 3
tbell16c34dd2009-05-04 18:28:26 -07001721
1722.LP
duke6e45e102007-12-01 00:00:00 +00001723.LP
1724Refer to the overridden method.
1725.LP
1726.RE
tbell16c34dd2009-05-04 18:28:26 -07001727.LP
duke6e45e102007-12-01 00:00:00 +00001728.TP 3
1729{@literal\ text}
1730Displays \f2text\fP without interpreting the text as HTML markup or nested javadoc tags. This enables you to use regular angle brackets (\f2<\fP and \f2>\fP) instead of the HTML entities (\f2<\fP and \f2>\fP) in doc comments, such as in parameter types (\f2<Object>\fP), inequalities (\f23 < 4\fP), or arrows (\f2<\-\fP). For example, the doc comment text:
1731.nf
1732\f3
1733.fl
1734 \fP\f4{@literal A<B>C}\fP\f3
1735.fl
tbell16c34dd2009-05-04 18:28:26 -07001736
1737.fl
duke6e45e102007-12-01 00:00:00 +00001738\fP
1739.fi
tbell16c34dd2009-05-04 18:28:26 -07001740.LP
duke6e45e102007-12-01 00:00:00 +00001741displays unchanged in the generated HTML page in your browser, as:
1742.LP
tbell16c34dd2009-05-04 18:28:26 -07001743\f2\ \ \ \ \ \fPA<B>C
1744.LP
1745The noteworthy point is that the \f2<B>\fP is not interpreted as bold (and it is not in code font).
duke6e45e102007-12-01 00:00:00 +00001746.LP
1747If you want the same functionality but with the text in code font, use \f2{@code}\fP.
1748.LP
1749.TP 3
1750@param\ parameter\-name description
1751Adds a parameter with the specified \f2parameter\-name\fP followed by the specified \f2description\fP to the "Parameters" section. When writing the doc comment, you may continue the \f2description\fP onto multiple lines. This tag is valid only in a doc comment for a method, constructor or class.
1752.LP
1753The \f2parameter\-name\fP can be the name of a parameter in a method or constructor, or the name of a type parameter of a class, method or constructor. Use angle brackets around this parameter name to specify the use of a type parameter.
1754.LP
1755Example of a type parameter of a class:
1756.nf
1757\f3
1758.fl
1759 /**
1760.fl
1761 * @param <E> Type of element stored in a list
1762.fl
1763 */
1764.fl
1765 public interface List<E> extends Collection<E> {
1766.fl
1767 }
1768.fl
tbell16c34dd2009-05-04 18:28:26 -07001769
1770.fl
duke6e45e102007-12-01 00:00:00 +00001771\fP
1772.fi
1773.LP
1774Example of a type parameter of a method:
1775.nf
1776\f3
1777.fl
1778 /**
1779.fl
1780 * @param string the string to be converted
1781.fl
1782 * @param type the type to convert the string to
1783.fl
1784 * @param <T> the type of the element
1785.fl
1786 * @param <V> the value of the element
1787.fl
1788 */
1789.fl
1790 <T, V extends T> V convert(String string, Class<T> type) {
1791.fl
1792 }
1793.fl
tbell16c34dd2009-05-04 18:28:26 -07001794
1795.fl
duke6e45e102007-12-01 00:00:00 +00001796\fP
1797.fi
tbell16c34dd2009-05-04 18:28:26 -07001798.LP
duke6e45e102007-12-01 00:00:00 +00001799For more details, see
1800.na
1801\f2writing @param tags\fP @
1802.fi
1803http://java.sun.com/j2se/javadoc/writingdoccomments/index.html#@param.
1804.LP
1805.TP 3
1806@return\ description
1807Adds a "Returns" section with the \f2description\fP text. This text should describe the return type and permissible range of values. This tag is valid only in a doc comment for a method.
1808.LP
1809For more details, see
1810.na
1811\f2writing @return tags\fP @
1812.fi
1813http://java.sun.com/j2se/javadoc/writingdoccomments/index.html#@return.
1814.LP
1815.TP 3
1816@see\ reference
1817Adds a "See Also" heading with a link or text entry that points to \f2reference\fP. A doc comment may contain any number of \f2@see\fP tags, which are all grouped under the same heading. The \f2@see\fP tag has three variations; the third form below is the most common. This tag is valid in any doc comment: overview, package, class, interface, constructor, method or field. For inserting an in\-line link within a sentence to a package, class or member, see \f2{@link}\fP.
1818.RS 3
1819.TP 3
1820@see "string"
1821Adds a text entry for \f2string\fP. No link is generated. The \f2string\fP is a book or other reference to information not available by URL. The Javadoc tool distinguishes this from the previous cases by looking for a double\-quote (\f2"\fP) as the first character. For example:
1822.nf
1823\f3
1824.fl
1825 @see "The Java Programming Language"
1826.fl
tbell16c34dd2009-05-04 18:28:26 -07001827
1828.fl
duke6e45e102007-12-01 00:00:00 +00001829\fP
1830.fi
tbell16c34dd2009-05-04 18:28:26 -07001831.LP
1832This generates text such as:
1833.RE
1834.RE
1835.RS 3
1836.RS 3
1837.RS 3
1838
1839.LP
duke6e45e102007-12-01 00:00:00 +00001840.RS 3
1841.RS 3
1842.TP 3
1843See Also:
1844"The Java Programming Language"
1845.RE
tbell16c34dd2009-05-04 18:28:26 -07001846.RE
duke6e45e102007-12-01 00:00:00 +00001847
1848.LP
1849.RE
1850.TP 3
1851@see <a href="URL#value">label</a>
1852Adds a link as defined by \f2URL\fP#\f2value\fP. The \f2URL\fP#\f2value\fP is a relative or absolute URL. The Javadoc tool distinguishes this from other cases by looking for a less\-than symbol (\f2<\fP) as the first character. For example:
1853.nf
1854\f3
1855.fl
1856 @see <a href="spec.html#section">Java Spec</a>
1857.fl
1858\fP
1859.fi
1860This generates a link such as:
1861.RS 3
1862.RS 3
1863.TP 3
1864See Also:
1865Java Spec
1866.RE
1867
1868.LP
1869.RE
1870.TP 3
1871@see\ package.class#member\ label
1872Adds a link, with visible text \f2label\fP, that points to the documentation for the specified name in the Java Language that is referenced. The \f2label\fP is optional; if omitted, the name appears instead as the visible text, suitably shortened \-\- see How a name is displayed. Use \-noqualifier to globally remove the package name from this visible text. Use the label when you want the visible text to be different from the auto\-generated visible text.
1873.LP
1874Only in version 1.2, just the name but not the label would automatically appear in <code> HTML tags, Starting with 1.2.2, the <code> is always included around the visible text, whether or not a label is used.
1875.LP
1876.RS 3
1877.TP 2
1878o
1879\f4package.class\fP\f4#\fP\f4member\fP is any valid program element name that is referenced \-\- a package, class, interface, constructor, method or field name \-\- except that the character ahead of the member name should be a hash character (\f2#\fP). The \f2class\fP represents any top\-level or nested class or interface. The \f2member\fP represents any constructor, method or field (not a nested class or interface). If this name is in the documented classes, the Javadoc tool will automatically create a link to it. To create links to external referenced classes, use the \f2\-link\fP option. Use either of the other two \f2@see\fP forms for referring to documentation of a name that does not belong to a referenced class. This argument is described at greater length below under Specifying a Name.
1880.TP 2
1881o
1882\f4label\fP is optional text that is visible as the link's label. The \f2label\fP can contain whitespace. If \f2label\fP is omitted, then \f2package.class.member\fP will appear, suitably shortened relative to the current class and package \-\- see How a name is displayed.
1883.TP 2
1884o
1885A space is the delimiter between \f2package.class\fP\f2#\fP\f2member\fP and \f2label\fP. A space inside parentheses does not indicate the start of a label, so spaces may be used between parameters in a method.
1886.RE
1887.LP
1888\f3Example\fP \- In this example, an \f2@see\fP tag (in the \f2Character\fP class) refers to the \f2equals\fP method in the \f2String\fP class. The tag includes both arguments: the name "\f2String#equals(Object)\fP" and the label "\f2equals\fP".
1889.RS 3
1890.nf
1891\f3
1892.fl
1893 /**
1894.fl
1895 * @see String#equals(Object) equals
1896.fl
1897 */
1898.fl
1899\fP
1900.fi
1901.RE
1902The standard doclet produces HTML something like this:
1903.RS 3
1904
1905.LP
1906.nf
1907\f3
1908.fl
1909<dl>
1910.fl
1911<dt><b>See Also:</b>
1912.fl
1913<dd><a href="../../java/lang/String#equals(java.lang.Object)"><code>equals<code></a>
1914.fl
1915</dl>
1916.fl
1917\fP
1918.fi
1919.RE
1920Which looks something like this in a browser, where the label is the visible link text:
1921.RS 3
1922
1923.LP
1924.RS 3
1925.TP 3
1926See Also:
1927equals
1928.RE
1929
1930.LP
1931.RE
1932.LP
1933\f3Specifying a name\fP \- This \f2package.class\fP\f2#\fP\f2member\fP name can be either fully\-qualified, such as \f2java.lang.String#toUpperCase()\fP or not, such as \f2String#toUpperCase()\fP or \f2#toUpperCase()\fP. If less than fully\-qualified, the Javadoc tool uses the normal Java compiler search order to find it, further described below in Search order for @see. The name can contain whitespace within parentheses, such as between method arguments.
1934.LP
1935Of course the advantage of providing shorter, "partially\-qualified" names is that they are shorter to type and there is less clutter in the source code. The following table shows the different forms of the name, where \f2Class\fP can be a class or interface, \f2Type\fP can be a class, interface, array, or primitive, and \f2method\fP can be a method or constructor.
1936.LP
1937.LP
1938.TS
1939.if \n+(b.=1 .nr d. \n(.c-\n(c.-1
1940.de 35
1941.ps \n(.s
1942.vs \n(.vu
1943.in \n(.iu
1944.if \n(.u .fi
1945.if \n(.j .ad
1946.if \n(.j=0 .na
1947..
1948.nf
1949.nr #~ 0
1950.if n .nr #~ 0.6n
1951.ds #d .d
1952.if \(ts\n(.z\(ts\(ts .ds #d nl
1953.fc
1954.nr 33 \n(.s
1955.rm 80
1956.nr 34 \n(.lu
1957.eo
1958.am 80
1959.br
1960.di a+
1961.35
1962.ft \n(.f
1963.ll \n(34u*1u/2u
1964.if \n(.l<\n(80 .ll \n(80u
1965.in 0
1966\f3Typical\ forms\ for\ \fP\f4@see\fP\f3\ \fP\f4package.class#member\fP
1967.br
1968.di
1969.nr a| \n(dn
1970.nr a- \n(dl
1971..
1972.ec \
1973.eo
1974.am 80
1975.br
1976.di b+
1977.35
1978.ft \n(.f
1979.ll \n(34u*1u/2u
1980.if \n(.l<\n(80 .ll \n(80u
1981.in 0
1982\f3Referencing\ a\ member\ of\ the\ current\ class\fP
1983.br
1984\f2@see\fP\ \f2#\fP\f2field\fP
1985.br
1986\f2@see\fP\ \f2#\fP\f2method(Type,\ Type,...)\fP
1987.br
1988\f2@see\fP\ \f2#\fP\f2method(Type\ argname,\ Type\ argname,...)\fP
1989.br
1990\f2@see\fP\ \f2#\fP\f2constructor(Type,\ Type,...)\fP
1991.br
1992\f2@see\fP\ \f2#\fP\f2constructor(Type\ argname,\ Type\ argname,...)\fP
1993.br
1994.di
1995.nr b| \n(dn
1996.nr b- \n(dl
1997..
1998.ec \
1999.eo
2000.am 80
2001.br
2002.di c+
2003.35
2004.ft \n(.f
2005.ll \n(34u*1u/2u
2006.if \n(.l<\n(80 .ll \n(80u
2007.in 0
2008\f3Referencing\ another\ class\ in\ the\ current\ or\ imported\ packages\fP
2009.br
2010\f2@see\fP\ \f2Class\fP\f2#\fP\f2field\fP
2011.br
2012\f2@see\fP\ \f2Class\fP\f2#\fP\f2method(Type,\ Type,...)\fP
2013.br
2014\f2@see\fP\ \f2Class\fP\f2#\fP\f2method(Type\ argname,\ Type\ argname,...)\fP
2015.br
2016\f2@see\fP\ \f2Class\fP\f2#\fP\f2constructor(Type,\ Type,...)\fP
2017.br
2018\f2@see\fP\ \f2Class\fP\f2#\fP\f2constructor(Type\ argname,\ Type\ argname,...)\fP
2019.br
2020\f2@see\fP\ \f2Class.NestedClass\fP
2021.br
2022\f2@see\fP\ \f2Class\fP
2023.br
2024.di
2025.nr c| \n(dn
2026.nr c- \n(dl
2027..
2028.ec \
2029.eo
2030.am 80
2031.br
2032.di d+
2033.35
2034.ft \n(.f
2035.ll \n(34u*1u/2u
2036.if \n(.l<\n(80 .ll \n(80u
2037.in 0
2038\f3Referencing\ an\ element\ in\ another\ package\fP\ (fully qualified)
2039.br
2040\f2@see\fP\ \f2package.Class\fP\f2#\fP\f2field\fP
2041.br
2042\f2@see\fP\ \f2package.Class\fP\f2#\fP\f2method(Type,\ Type,...)\fP
2043.br
2044\f2@see\fP\ \f2package.Class\fP\f2#\fP\f2method(Type\ argname,\ Type\ argname,...)\fP
2045.br
2046\f2@see\fP\ \f2package.Class\fP\f2#\fP\f2constructor(Type,\ Type,...)\fP
2047.br
2048\f2@see\fP\ \f2package.Class\fP\f2#\fP\f2constructor(Type\ argname,\ Type\ argname,...)\fP
2049.br
2050\f2@see\fP\ \f2package.Class.NestedClass\fP
2051.br
2052\f2@see\fP\ \f2package.Class\fP
2053.br
2054\f2@see\fP\ \f2package\fP
2055.br
2056.di
2057.nr d| \n(dn
2058.nr d- \n(dl
2059..
2060.ec \
2061.35
2062.nf
2063.ll \n(34u
2064.nr 80 0
2065.80
2066.rm 80
2067.nr 38 \n(a-
2068.if \n(80<\n(38 .nr 80 \n(38
2069.nr 38 \n(b-
2070.if \n(80<\n(38 .nr 80 \n(38
2071.nr 38 \n(c-
2072.if \n(80<\n(38 .nr 80 \n(38
2073.nr 38 \n(d-
2074.if \n(80<\n(38 .nr 80 \n(38
2075.35
2076.nf
2077.ll \n(34u
2078.nr 38 1n
2079.nr 79 0
2080.nr 40 \n(79+(0*\n(38)
2081.nr 80 +\n(40
2082.nr TW \n(80
tbell16c34dd2009-05-04 18:28:26 -07002083.if t .if \n(TW>\n(.li .tm Table at line 1666 file Input is too wide - \n(TW units
duke6e45e102007-12-01 00:00:00 +00002084.fc  
2085.nr #T 0-1
2086.nr #a 0-1
2087.eo
2088.de T#
2089.ds #d .d
2090.if \(ts\n(.z\(ts\(ts .ds #d nl
2091.mk ##
2092.nr ## -1v
2093.ls 1
2094.ls
2095..
2096.ec
2097.ne \n(a|u+\n(.Vu
2098.if (\n(a|+\n(#^-1v)>\n(#- .nr #- +(\n(a|+\n(#^-\n(#--1v)
2099.ta \n(80u
2100.nr 31 \n(.f
2101.nr 35 1m
2102\&\h'|\n(40u'
2103.mk ##
2104.nr 31 \n(##
2105.sp |\n(##u-1v
2106.nr 37 \n(40u
2107.in +\n(37u
2108.a+
2109.in -\n(37u
2110.mk 32
2111.if \n(32>\n(31 .nr 31 \n(32
2112.sp |\n(31u
2113.ne \n(b|u+\n(.Vu
2114.if (\n(b|+\n(#^-1v)>\n(#- .nr #- +(\n(b|+\n(#^-\n(#--1v)
2115.ta \n(80u
2116.nr 31 \n(.f
2117.nr 35 1m
2118\&\h'|\n(40u'
2119.mk ##
2120.nr 31 \n(##
2121.sp |\n(##u-1v
2122.nr 37 \n(40u
2123.in +\n(37u
2124.b+
2125.in -\n(37u
2126.mk 32
2127.if \n(32>\n(31 .nr 31 \n(32
2128.sp |\n(31u
2129.ne \n(c|u+\n(.Vu
2130.if (\n(c|+\n(#^-1v)>\n(#- .nr #- +(\n(c|+\n(#^-\n(#--1v)
2131.ta \n(80u
2132.nr 31 \n(.f
2133.nr 35 1m
2134\&\h'|\n(40u'
2135.mk ##
2136.nr 31 \n(##
2137.sp |\n(##u-1v
2138.nr 37 \n(40u
2139.in +\n(37u
2140.c+
2141.in -\n(37u
2142.mk 32
2143.if \n(32>\n(31 .nr 31 \n(32
2144.sp |\n(31u
2145.ne \n(d|u+\n(.Vu
2146.if (\n(d|+\n(#^-1v)>\n(#- .nr #- +(\n(d|+\n(#^-\n(#--1v)
2147.ta \n(80u
2148.nr 31 \n(.f
2149.nr 35 1m
2150\&\h'|\n(40u'
2151.mk ##
2152.nr 31 \n(##
2153.sp |\n(##u-1v
2154.nr 37 \n(40u
2155.in +\n(37u
2156.d+
2157.in -\n(37u
2158.mk 32
2159.if \n(32>\n(31 .nr 31 \n(32
2160.sp |\n(31u
2161.fc
2162.nr T. 1
2163.T# 1
2164.35
2165.rm a+
2166.rm b+
2167.rm c+
2168.rm d+
2169.TE
2170.if \n-(b.=0 .nr c. \n(.c-\n(d.-58
2171.LP
2172The following notes apply to the above table:
2173.RS 3
2174.TP 2
2175o
2176The first set of forms (with no class or package) will cause the Javadoc tool to search only through the current class's hierarchy. It will find a member of the current class or interface, one of its superclasses or superinterfaces, or one of its enclosing classes or interfaces (search steps 1\-3). It will not search the rest of the current package or other packages (search steps 4\-5).
2177.TP 2
2178o
2179If any method or constructor is entered as a name with no parentheses, such as \f2getValue\fP, and if there is no field with the same name, the Javadoc tool will correctly create a link to it, but will print a warning message reminding you to add the parentheses and arguments. If this method is overloaded, the Javadoc tool will link to the first method its search encounters, which is unspecified.
2180.TP 2
2181o
2182Nested classes must be specified as \f2outer\fP\f2.\fP\f2inner\fP, not simply \f2inner\fP, for all forms.
2183.TP 2
2184o
2185As stated, the hash character (\f2#\fP), rather than a dot (\f2.\fP) separates a member from its class. This enables the Javadoc tool to resolve ambiguities, since the dot also separates classes, nested classes, packages, and subpackages. However, the Javadoc tool is generally lenient and will properly parse a dot if you know there is no ambiguity, though it will print a warning.
2186.RE
2187.LP
2188\f3Search order for @see\fP \- the Javadoc tool will process a \f2@see\fP tag that appears in a source file (.java), package file (package.html or package\-info.java) or overview file (overview.html). In the latter two files, you must fully\-qualify the name you supply with \f2@see\fP. In a source file, you can specify a name that is fully\-qualified or partially\-qualified.
2189.LP
2190When the Javadoc tool encounters a \f2@see\fP tag in a \f2.java\fP file that is \f2not\fP fully qualified, it searches for the specified name in the same order as the Java compiler would (except the Javadoc tool will not detect certain namespace ambiguities, since it assumes the source code is free of these errors). This search order is formally defined in Chapter 6, "Names" of the \f2Java Language Specification\fP, Second Edition. The Javadoc tool searches for that name through all related and imported classes and packages. In particular, it searches in this order:
2191.RS 3
2192.TP 3
21931.
2194the current class or interface
2195.TP 3
21962.
2197any enclosing classes and interfaces, searching closest first
2198.TP 3
21993.
2200any superclasses and superinterfaces, searching closest first
2201.TP 3
22024.
2203the current package
2204.TP 3
22055.
2206any imported packages, classes and interfaces, searching in the order of the import statement
2207.RE
2208.LP
2209The Javadoc tool continues to search recursively through steps 1\-3 for each class it encounters until it finds a match. That is, after it searches through the current class and its enclosing class E, it will search through E's superclasses before E's enclosing classes. In steps 4 and 5, the Javadoc tool does not search classes or interfaces within a package in any specified order (that order depends on the particular compiler). In step 5, the Javadoc tool looks in java.lang, since that is automatically imported by all programs.
2210.LP
2211The Javadoc tool does not necessarily look in subclasses, nor will it look in other packages even if their documentation is being generated in the same run. For example, if the \f2@see\fP tag is in the \f2java.awt.event.KeyEvent\fP class and refers to a name in the \f2java.awt\fP package, javadoc does not look in that package unless that class imports it.
2212.LP
2213\f3How a name is displayed\fP \- If \f2label\fP is omitted, then \f2package.class.member\fP appears. In general, it is suitably shortened relative to the current class and package. By "shortened", we mean the Javadoc tool displays only the minimum name necessary. For example, if the \f2String.toUpperCase()\fP method contains references to a member of the same class and to a member of a different class, the class name is displayed only in the latter case, as shown in the following table.
2214.LP
2215Use \-noqualifier to globally remove the package names.
2216.br
2217.LP
2218.TS
2219.if \n+(b.=1 .nr d. \n(.c-\n(c.-1
2220.de 35
2221.ps \n(.s
2222.vs \n(.vu
2223.in \n(.iu
2224.if \n(.u .fi
2225.if \n(.j .ad
2226.if \n(.j=0 .na
2227..
2228.nf
2229.nr #~ 0
2230.if n .nr #~ 0.6n
2231.ds #d .d
2232.if \(ts\n(.z\(ts\(ts .ds #d nl
2233.fc
2234.nr 33 \n(.s
2235.rm 80 81 82
2236.nr 34 \n(.lu
2237.eo
2238.am 81
2239.br
2240.di a+
2241.35
2242.ft \n(.f
2243.ll \n(34u*1u/4u
2244.if \n(.l<\n(81 .ll \n(81u
2245.in 0
2246\f3Example in \fP\f4String.toUpperCase()\fP
2247.br
2248.di
2249.nr a| \n(dn
2250.nr a- \n(dl
2251..
2252.ec \
2253.eo
2254.am 80
2255.br
2256.di b+
2257.35
2258.ft \n(.f
2259.ll \n(34u*1u/4u
2260.if \n(.l<\n(80 .ll \n(80u
2261.in 0
2262\f2@see\fP tag refers to member of the same class, same package
2263.br
2264.di
2265.nr b| \n(dn
2266.nr b- \n(dl
2267..
2268.ec \
2269.eo
2270.am 82
2271.br
2272.di c+
2273.35
2274.ft \n(.f
2275.ll \n(34u*1u/4u
2276.if \n(.l<\n(82 .ll \n(82u
2277.in 0
2278\f2toLowerCase()\fP (omits the package and class names)
2279.br
2280.di
2281.nr c| \n(dn
2282.nr c- \n(dl
2283..
2284.ec \
2285.eo
2286.am 80
2287.br
2288.di d+
2289.35
2290.ft \n(.f
2291.ll \n(34u*1u/4u
2292.if \n(.l<\n(80 .ll \n(80u
2293.in 0
2294\f2@see\fP tag refers to member of a different class, same package
2295.br
2296.di
2297.nr d| \n(dn
2298.nr d- \n(dl
2299..
2300.ec \
2301.eo
2302.am 81
2303.br
2304.di e+
2305.35
2306.ft \n(.f
2307.ll \n(34u*1u/4u
2308.if \n(.l<\n(81 .ll \n(81u
2309.in 0
2310\f2@see Character#toLowerCase(char)\fP
2311.br
2312.di
2313.nr e| \n(dn
2314.nr e- \n(dl
2315..
2316.ec \
2317.eo
2318.am 82
2319.br
2320.di f+
2321.35
2322.ft \n(.f
2323.ll \n(34u*1u/4u
2324.if \n(.l<\n(82 .ll \n(82u
2325.in 0
2326\f2Character.toLowerCase(char)\fP (omits the package name, includes the class name)
2327.br
2328.di
2329.nr f| \n(dn
2330.nr f- \n(dl
2331..
2332.ec \
2333.eo
2334.am 80
2335.br
2336.di g+
2337.35
2338.ft \n(.f
2339.ll \n(34u*1u/4u
2340.if \n(.l<\n(80 .ll \n(80u
2341.in 0
2342\f2@see\fP tag refers to member of a different class, different package
2343.br
2344.di
2345.nr g| \n(dn
2346.nr g- \n(dl
2347..
2348.ec \
2349.eo
2350.am 81
2351.br
2352.di h+
2353.35
2354.ft \n(.f
2355.ll \n(34u*1u/4u
2356.if \n(.l<\n(81 .ll \n(81u
2357.in 0
2358\f2@see java.io.File#exists()\fP
2359.br
2360.di
2361.nr h| \n(dn
2362.nr h- \n(dl
2363..
2364.ec \
2365.eo
2366.am 82
2367.br
2368.di i+
2369.35
2370.ft \n(.f
2371.ll \n(34u*1u/4u
2372.if \n(.l<\n(82 .ll \n(82u
2373.in 0
2374\f2java.io.File.exists()\fP (includes the package and class names)
2375.br
2376.di
2377.nr i| \n(dn
2378.nr i- \n(dl
2379..
2380.ec \
2381.35
2382.nf
2383.ll \n(34u
2384.nr 80 0
2385.nr 38 \w\f3Type of Reference\fP
2386.if \n(80<\n(38 .nr 80 \n(38
2387.80
2388.rm 80
2389.nr 38 \n(b-
2390.if \n(80<\n(38 .nr 80 \n(38
2391.nr 38 \n(d-
2392.if \n(80<\n(38 .nr 80 \n(38
2393.nr 38 \n(g-
2394.if \n(80<\n(38 .nr 80 \n(38
2395.nr 81 0
2396.nr 38 \w\f2@see String#toLowerCase()\fP
2397.if \n(81<\n(38 .nr 81 \n(38
2398.81
2399.rm 81
2400.nr 38 \n(a-
2401.if \n(81<\n(38 .nr 81 \n(38
2402.nr 38 \n(e-
2403.if \n(81<\n(38 .nr 81 \n(38
2404.nr 38 \n(h-
2405.if \n(81<\n(38 .nr 81 \n(38
2406.nr 82 0
2407.nr 38 \w\f3Displays As\fP
2408.if \n(82<\n(38 .nr 82 \n(38
2409.82
2410.rm 82
2411.nr 38 \n(c-
2412.if \n(82<\n(38 .nr 82 \n(38
2413.nr 38 \n(f-
2414.if \n(82<\n(38 .nr 82 \n(38
2415.nr 38 \n(i-
2416.if \n(82<\n(38 .nr 82 \n(38
2417.35
2418.nf
2419.ll \n(34u
2420.nr 38 1n
2421.nr 79 0
2422.nr 40 \n(79+(0*\n(38)
2423.nr 80 +\n(40
2424.nr 41 \n(80+(3*\n(38)
2425.nr 81 +\n(41
2426.nr 42 \n(81+(3*\n(38)
2427.nr 82 +\n(42
2428.nr TW \n(82
tbell16c34dd2009-05-04 18:28:26 -07002429.if t .if \n(TW>\n(.li .tm Table at line 1742 file Input is too wide - \n(TW units
duke6e45e102007-12-01 00:00:00 +00002430.fc  
2431.nr #T 0-1
2432.nr #a 0-1
2433.eo
2434.de T#
2435.ds #d .d
2436.if \(ts\n(.z\(ts\(ts .ds #d nl
2437.mk ##
2438.nr ## -1v
2439.ls 1
2440.ls
2441..
2442.ec
2443.ne \n(a|u+\n(.Vu
2444.if (\n(a|+\n(#^-1v)>\n(#- .nr #- +(\n(a|+\n(#^-\n(#--1v)
2445.ta \n(80u \n(81u \n(82u
2446.nr 31 \n(.f
2447.nr 35 1m
2448\&\h'|\n(40u'\f3Type of Reference\fP\h'|\n(41u'\h'|\n(42u'\f3Displays As\fP
2449.mk ##
2450.nr 31 \n(##
2451.sp |\n(##u-1v
2452.nr 37 \n(41u
2453.in +\n(37u
2454.a+
2455.in -\n(37u
2456.mk 32
2457.if \n(32>\n(31 .nr 31 \n(32
2458.sp |\n(31u
2459.ne \n(b|u+\n(.Vu
2460.ne \n(c|u+\n(.Vu
2461.if (\n(b|+\n(#^-1v)>\n(#- .nr #- +(\n(b|+\n(#^-\n(#--1v)
2462.if (\n(c|+\n(#^-1v)>\n(#- .nr #- +(\n(c|+\n(#^-\n(#--1v)
2463.ta \n(80u \n(81u \n(82u
2464.nr 31 \n(.f
2465.nr 35 1m
2466\&\h'|\n(40u'\h'|\n(41u'\f2@see String#toLowerCase()\fP\h'|\n(42u'
2467.mk ##
2468.nr 31 \n(##
2469.sp |\n(##u-1v
2470.nr 37 \n(40u
2471.in +\n(37u
2472.b+
2473.in -\n(37u
2474.mk 32
2475.if \n(32>\n(31 .nr 31 \n(32
2476.sp |\n(##u-1v
2477.nr 37 \n(42u
2478.in +\n(37u
2479.c+
2480.in -\n(37u
2481.mk 32
2482.if \n(32>\n(31 .nr 31 \n(32
2483.sp |\n(31u
2484.ne \n(d|u+\n(.Vu
2485.ne \n(e|u+\n(.Vu
2486.ne \n(f|u+\n(.Vu
2487.if (\n(d|+\n(#^-1v)>\n(#- .nr #- +(\n(d|+\n(#^-\n(#--1v)
2488.if (\n(e|+\n(#^-1v)>\n(#- .nr #- +(\n(e|+\n(#^-\n(#--1v)
2489.if (\n(f|+\n(#^-1v)>\n(#- .nr #- +(\n(f|+\n(#^-\n(#--1v)
2490.ta \n(80u \n(81u \n(82u
2491.nr 31 \n(.f
2492.nr 35 1m
2493\&\h'|\n(40u'\h'|\n(41u'\h'|\n(42u'
2494.mk ##
2495.nr 31 \n(##
2496.sp |\n(##u-1v
2497.nr 37 \n(40u
2498.in +\n(37u
2499.d+
2500.in -\n(37u
2501.mk 32
2502.if \n(32>\n(31 .nr 31 \n(32
2503.sp |\n(##u-1v
2504.nr 37 \n(41u
2505.in +\n(37u
2506.e+
2507.in -\n(37u
2508.mk 32
2509.if \n(32>\n(31 .nr 31 \n(32
2510.sp |\n(##u-1v
2511.nr 37 \n(42u
2512.in +\n(37u
2513.f+
2514.in -\n(37u
2515.mk 32
2516.if \n(32>\n(31 .nr 31 \n(32
2517.sp |\n(31u
2518.ne \n(g|u+\n(.Vu
2519.ne \n(h|u+\n(.Vu
2520.ne \n(i|u+\n(.Vu
2521.if (\n(g|+\n(#^-1v)>\n(#- .nr #- +(\n(g|+\n(#^-\n(#--1v)
2522.if (\n(h|+\n(#^-1v)>\n(#- .nr #- +(\n(h|+\n(#^-\n(#--1v)
2523.if (\n(i|+\n(#^-1v)>\n(#- .nr #- +(\n(i|+\n(#^-\n(#--1v)
2524.ta \n(80u \n(81u \n(82u
2525.nr 31 \n(.f
2526.nr 35 1m
2527\&\h'|\n(40u'\h'|\n(41u'\h'|\n(42u'
2528.mk ##
2529.nr 31 \n(##
2530.sp |\n(##u-1v
2531.nr 37 \n(40u
2532.in +\n(37u
2533.g+
2534.in -\n(37u
2535.mk 32
2536.if \n(32>\n(31 .nr 31 \n(32
2537.sp |\n(##u-1v
2538.nr 37 \n(41u
2539.in +\n(37u
2540.h+
2541.in -\n(37u
2542.mk 32
2543.if \n(32>\n(31 .nr 31 \n(32
2544.sp |\n(##u-1v
2545.nr 37 \n(42u
2546.in +\n(37u
2547.i+
2548.in -\n(37u
2549.mk 32
2550.if \n(32>\n(31 .nr 31 \n(32
2551.sp |\n(31u
2552.fc
2553.nr T. 1
2554.T# 1
2555.35
2556.rm a+
2557.rm b+
2558.rm c+
2559.rm d+
2560.rm e+
2561.rm f+
2562.rm g+
2563.rm h+
2564.rm i+
2565.TE
2566.if \n-(b.=0 .nr c. \n(.c-\n(d.-28
2567.LP
2568\f3Examples of @see\fP
2569.br
2570The comment to the right shows how the name would be displayed if the \f2@see\fP tag is in a class in another package, such as \f2java.applet.Applet\fP.
2571.nf
2572\f3
2573.fl
2574 See also:
2575.fl
2576@see java.lang.String // String \fP\f3
2577.fl
2578@see java.lang.String The String class // The String class \fP\f3
2579.fl
2580@see String // String \fP\f3
2581.fl
2582@see String#equals(Object) // String.equals(Object) \fP\f3
2583.fl
2584@see String#equals // String.equals(java.lang.Object) \fP\f3
2585.fl
2586@see java.lang.Object#wait(long) // java.lang.Object.wait(long) \fP\f3
2587.fl
2588@see Character#MAX_RADIX // Character.MAX_RADIX \fP\f3
2589.fl
2590@see <a href="spec.html">Java Spec</a> // Java Spec \fP\f3
2591.fl
2592@see "The Java Programming Language" // "The Java Programming Language" \fP\f3
2593.fl
2594\fP
2595.fi
2596You can extend \f2@see\fP to link to classes not being documented by using the \f2\-link\fP option.
2597.LP
2598For more details, see
2599.na
2600\f2writing @see tags\fP @
2601.fi
2602http://java.sun.com/j2se/javadoc/writingdoccomments/index.html#@see.
2603.RE
tbell16c34dd2009-05-04 18:28:26 -07002604.RE
2605.RS 3
2606
2607.LP
2608.LP
2609
2610.LP
2611.RS 3
duke6e45e102007-12-01 00:00:00 +00002612.TP 3
2613@serial\ field\-description | include | exclude
2614Used in the doc comment for a default serializable field.
2615.LP
2616An optional \f2field\-description\fP should explain the meaning of the field and list the acceptable values. If needed, the description can span multiple lines. The standard doclet adds this information to the serialized form page.
2617.LP
2618If a serializable field was added to a class some time after the class was made serializable, a statement should be added to its main description to identify at which version it was added.
2619.LP
2620The \f2include\fP and \f2exclude\fP arguments identify whether a class or package should be included or excluded from the serialized form page. They work as follows:
2621.RS 3
2622.TP 2
2623o
2624A public or protected class that implements \f2Serializable\fP is \f2included\fP unless that class (or its package) is marked \f2@serial exclude\fP.
2625.TP 2
2626o
2627A private or package\-private class that implements \f2Serializable\fP is \f2excluded\fP unless that class (or its package) is marked \f2@serial include\fP.
2628.RE
2629.LP
2630Examples: The \f2javax.swing\fP package is marked \f2@serial exclude\fP (in \f2package.html\fP or \f2package\-info.java\fP). The public class \f2java.security.BasicPermission\fP is marked \f2@serial exclude\fP. The package\-private class \f2java.util.PropertyPermissionCollection\fP is marked \f2@serial include\fP.
2631.LP
2632The tag @serial at a class level overrides @serial at a package level.
2633.LP
tbell16c34dd2009-05-04 18:28:26 -07002634For more information about how to use these tags, along with an example, see "
2635.na
2636\f2Documenting Serializable Fields and Data for a Class\fP @
2637.fi
2638http://java.sun.com/javase/6/docs/platform/serialization/spec/serial\-arch.html," Section 1.6 of the \f2Java Object Serialization Specification\fP. Also see the
duke6e45e102007-12-01 00:00:00 +00002639.na
2640\f2Serialization FAQ\fP @
2641.fi
2642http://java.sun.com/products/jdk/serialization/faq/#javadoc_warn_missing, which covers common questions, such as "Why do I see javadoc warnings stating that I am missing @serial tags for private fields if I am not running javadoc with the \-private switch?". Also see
2643.na
2644\f2Sun's criteria\fP @
2645.fi
2646http://java.sun.com/j2se/javadoc/writingapispecs/serialized\-criteria.html for including classes in the serialized form specification.
2647.LP
2648.TP 3
2649@serialField\ field\-name\ field\-type\ field\-description
2650Documents an \f2ObjectStreamField\fP component of a \f2Serializable\fP class's \f2serialPersistentFields\fP member. One \f2@serialField\fP tag should be used for each \f2ObjectStreamField\fP component.
2651.LP
2652.TP 3
2653@serialData\ data\-description
2654The \f2data\-description\fP documents the types and order of data in the serialized form. Specifically, this data includes the optional data written by the \f2writeObject\fP method and all data (including base classes) written by the \f2Externalizable.writeExternal\fP method.
2655.LP
2656The \f2@serialData\fP tag can be used in the doc comment for the \f2writeObject\fP, \f2readObject\fP, \f2writeExternal\fP, \f2readExternal\fP, \f2writeReplace\fP, and \f2readResolve\fP methods.
2657.LP
2658.TP 3
2659@since\ since\-text
2660Adds a "Since" heading with the specified \f2since\-text\fP to the generated documentation. The text has no special internal structure. This tag is valid in any doc comment: overview, package, class, interface, constructor, method or field. This tag means that this change or feature has existed since the software release specified by the \f2since\-text\fP. For example:
2661.nf
2662\f3
2663.fl
2664 @since 1.5
2665.fl
tbell16c34dd2009-05-04 18:28:26 -07002666
2667.fl
duke6e45e102007-12-01 00:00:00 +00002668\fP
2669.fi
tbell16c34dd2009-05-04 18:28:26 -07002670.LP
duke6e45e102007-12-01 00:00:00 +00002671For source code in the Java platform, this tag indicates the version of the Java platform API specification (not necessarily when it was added to the reference implementation). Multiple @since tags are allowed and are treated like multiple @author tags. You could use multiple tags if the prgram element is used by more than one API.
2672.LP
2673.TP 3
2674@throws\ class\-name\ description
2675The \f2@throws\fP and \f2@exception\fP tags are synonyms. Adds a "Throws" subheading to the generated documentation, with the \f2class\-name\fP and \f2description\fP text. The \f2class\-name\fP is the name of the exception that may be thrown by the method. This tag is valid only in the doc comment for a method or constructor. If this class is not fully\-specified, the Javadoc tool uses the search order to look up this class. Multiple \f2@throws\fP tags can be used in a given doc comment for the same or different exceptions.
2676.LP
2677To ensure that all checked exceptions are documented, if a \f2@throws\fP tag does not exist for an exception in the throws clause, the Javadoc tool automatically adds that exception to the HTML output (with no description) as if it were documented with @throws tag.
2678.LP
2679The \f2@throws\fP documentation is copied from an overridden method to a subclass only when the exception is explicitly declared in the overridden method. The same is true for copying from an interface method to an implementing method. You can use {@inheritDoc} to force @throws to inherit documentation.
2680.LP
2681For more details, see
2682.na
2683\f2writing @throws tags\fP @
2684.fi
2685http://java.sun.com/j2se/javadoc/writingdoccomments/index.html#@exception.
2686.LP
2687.TP 3
2688{@value\ package.class#field}
2689When \f2{@value}\fP is used (without any argument) in the doc comment of a static field, it displays the value of that constant:
2690.nf
2691\f3
2692.fl
2693 /**
2694.fl
2695 * The value of this constant is {@value}.
2696.fl
2697 */
2698.fl
2699 public static final String SCRIPT_START = "<script>"
2700.fl
tbell16c34dd2009-05-04 18:28:26 -07002701
2702.fl
duke6e45e102007-12-01 00:00:00 +00002703\fP
2704.fi
tbell16c34dd2009-05-04 18:28:26 -07002705.LP
duke6e45e102007-12-01 00:00:00 +00002706When used with argument \f2package.class#field\fP in any doc comment, it displays the value of the specified constant:
2707.nf
2708\f3
2709.fl
2710 /**
2711.fl
2712 * Evaluates the script starting with {@value #SCRIPT_START}.
2713.fl
2714 */
2715.fl
2716 public String evalScript(String script) {
2717.fl
2718 }
2719.fl
tbell16c34dd2009-05-04 18:28:26 -07002720
2721.fl
duke6e45e102007-12-01 00:00:00 +00002722\fP
2723.fi
tbell16c34dd2009-05-04 18:28:26 -07002724.LP
duke6e45e102007-12-01 00:00:00 +00002725The argument \f2package.class#field\fP takes a form identical to that of the @see argument, except that the member must be a static field.
2726.LP
tbell16c34dd2009-05-04 18:28:26 -07002727These values of these constants are also displayed on the
2728.na
2729\f2Constant Field Values\fP @
2730.fi
2731http://java.sun.com/javase/6/docs/api/constant\-values.html page.
duke6e45e102007-12-01 00:00:00 +00002732.LP
2733.TP 3
2734@version\ version\-text
2735Adds a "Version" subheading with the specified \f2version\-text\fP to the generated docs when the \-version option is used. This tag is intended to hold the current version number of the software that this code is part of (as opposed to @since, which holds the version number where this code was introduced). The \f2version\-text\fP has no special internal structure. To see where the version tag can be used, see Where Tags Can Be Used.
2736.LP
2737A doc comment may contain multiple \f2@version\fP tags. If it makes sense, you can specify one version number per \f2@version\fP tag or multiple version numbers per tag. In the former case, the Javadoc tool inserts a comma (\f2,\fP) and space between names. In the latter case, the entire text is simply copied to the generated document without being parsed. Therefore, you can use multiple names per line if you want a localized name separator other than comma.
2738.LP
2739For more details, see
2740.na
2741\f2writing @version tags\fP @
2742.fi
2743http://java.sun.com/j2se/javadoc/writingdoccomments/index.html#@version.
2744.RE
tbell16c34dd2009-05-04 18:28:26 -07002745
2746.LP
2747.RE
duke6e45e102007-12-01 00:00:00 +00002748.SS
2749Where Tags Can Be Used
2750.LP
2751.LP
2752The following sections describe where the tags can be used. Note that these tags can be used in all doc comments: \f2@see\fP, \f2@since\fP, \f2@deprecated\fP, \f2{@link}\fP, \f2{@linkplain}\fP, and \f2{@docroot}\fP.
2753.LP
2754.RS 3
2755
2756.LP
2757.SS
2758Overview Documentation Tags
2759.LP
2760.LP
2761Overview tags are tags that can appear in the documentation comment for the overview page (which resides in the source file typically named \f2overview.html\fP). Like in any other documentation comments, these tags must appear after the main description.
2762.LP
2763.LP
2764\f3NOTE\fP \- The \f2{@link}\fP tag has a bug in overview documents in version 1.2 \-\- the text appears properly but has no link. The \f2{@docRoot}\fP tag does not currently work in overview documents.
2765.LP
2766.LP
2767.TS
2768.if \n+(b.=1 .nr d. \n(.c-\n(c.-1
2769.de 35
2770.ps \n(.s
2771.vs \n(.vu
2772.in \n(.iu
2773.if \n(.u .fi
2774.if \n(.j .ad
2775.if \n(.j=0 .na
2776..
2777.nf
2778.nr #~ 0
2779.if n .nr #~ 0.6n
2780.ds #d .d
2781.if \(ts\n(.z\(ts\(ts .ds #d nl
2782.fc
2783.nr 33 \n(.s
2784.rm 80
2785.nr 34 \n(.lu
2786.eo
2787.am 80
2788.br
2789.di a+
2790.35
2791.ft \n(.f
2792.ll \n(34u*1u/2u
2793.if \n(.l<\n(80 .ll \n(80u
2794.in 0
2795\f2@see\fP
2796.br
2797\f2@since\fP
2798.br
2799\f2@author\fP
2800.br
2801\f2@version\fP
2802.br
2803\f2{@link}\fP
2804.br
2805\f2{@linkplain}\fP
2806.br
2807\f2{@docRoot}\fP
2808.br
2809.di
2810.nr a| \n(dn
2811.nr a- \n(dl
2812..
2813.ec \
2814.35
2815.nf
2816.ll \n(34u
2817.nr 80 0
2818.nr 38 \w\f3Overview Tags\fP
2819.if \n(80<\n(38 .nr 80 \n(38
2820.80
2821.rm 80
2822.nr 38 \n(a-
2823.if \n(80<\n(38 .nr 80 \n(38
2824.35
2825.nf
2826.ll \n(34u
2827.nr 38 1n
2828.nr 79 0
2829.nr 40 \n(79+(0*\n(38)
2830.nr 80 +\n(40
2831.nr TW \n(80
tbell16c34dd2009-05-04 18:28:26 -07002832.if t .if \n(TW>\n(.li .tm Table at line 1963 file Input is too wide - \n(TW units
duke6e45e102007-12-01 00:00:00 +00002833.fc  
2834.nr #T 0-1
2835.nr #a 0-1
2836.eo
2837.de T#
2838.ds #d .d
2839.if \(ts\n(.z\(ts\(ts .ds #d nl
2840.mk ##
2841.nr ## -1v
2842.ls 1
2843.ls
2844..
2845.ec
2846.ta \n(80u
2847.nr 31 \n(.f
2848.nr 35 1m
2849\&\h'|\n(40u'\f3Overview Tags\fP
2850.ne \n(a|u+\n(.Vu
2851.if (\n(a|+\n(#^-1v)>\n(#- .nr #- +(\n(a|+\n(#^-\n(#--1v)
2852.ta \n(80u
2853.nr 31 \n(.f
2854.nr 35 1m
2855\&\h'|\n(40u'
2856.mk ##
2857.nr 31 \n(##
2858.sp |\n(##u-1v
2859.nr 37 \n(40u
2860.in +\n(37u
2861.a+
2862.in -\n(37u
2863.mk 32
2864.if \n(32>\n(31 .nr 31 \n(32
2865.sp |\n(31u
2866.fc
2867.nr T. 1
2868.T# 1
2869.35
2870.rm a+
2871.TE
2872.if \n-(b.=0 .nr c. \n(.c-\n(d.-20
2873
2874.LP
2875.SS
2876Package Documentation Tags
2877.LP
2878.LP
2879Package tags are tags that can appear in the documentation comment for a package (which resides in the source file named \f2package.html\fP or \f2package\-info.java\fP). The \f2@serial\fP tag can only be used here with the \f2include\fP or \f2exclude\fP argument.
2880.LP
2881.LP
2882.TS
2883.if \n+(b.=1 .nr d. \n(.c-\n(c.-1
2884.de 35
2885.ps \n(.s
2886.vs \n(.vu
2887.in \n(.iu
2888.if \n(.u .fi
2889.if \n(.j .ad
2890.if \n(.j=0 .na
2891..
2892.nf
2893.nr #~ 0
2894.if n .nr #~ 0.6n
2895.ds #d .d
2896.if \(ts\n(.z\(ts\(ts .ds #d nl
2897.fc
2898.nr 33 \n(.s
2899.rm 80
2900.nr 34 \n(.lu
2901.eo
2902.am 80
2903.br
2904.di a+
2905.35
2906.ft \n(.f
2907.ll \n(34u*1u/2u
2908.if \n(.l<\n(80 .ll \n(80u
2909.in 0
2910\f2@see\fP
2911.br
2912\f2@since\fP
2913.br
2914\f2@serial\fP
2915.br
2916\f2@author\fP
2917.br
2918\f2@version\fP
2919.br
2920\f2{@link}\fP
2921.br
2922\f2{@linkplain}\fP
2923.br
2924\f2{@docRoot}\fP
2925.br
2926.di
2927.nr a| \n(dn
2928.nr a- \n(dl
2929..
2930.ec \
2931.35
2932.nf
2933.ll \n(34u
2934.nr 80 0
2935.nr 38 \w\f3Package Tags\fP
2936.if \n(80<\n(38 .nr 80 \n(38
2937.80
2938.rm 80
2939.nr 38 \n(a-
2940.if \n(80<\n(38 .nr 80 \n(38
2941.35
2942.nf
2943.ll \n(34u
2944.nr 38 1n
2945.nr 79 0
2946.nr 40 \n(79+(0*\n(38)
2947.nr 80 +\n(40
2948.nr TW \n(80
tbell16c34dd2009-05-04 18:28:26 -07002949.if t .if \n(TW>\n(.li .tm Table at line 1995 file Input is too wide - \n(TW units
duke6e45e102007-12-01 00:00:00 +00002950.fc  
2951.nr #T 0-1
2952.nr #a 0-1
2953.eo
2954.de T#
2955.ds #d .d
2956.if \(ts\n(.z\(ts\(ts .ds #d nl
2957.mk ##
2958.nr ## -1v
2959.ls 1
2960.ls
2961..
2962.ec
2963.ta \n(80u
2964.nr 31 \n(.f
2965.nr 35 1m
2966\&\h'|\n(40u'\f3Package Tags\fP
2967.ne \n(a|u+\n(.Vu
2968.if (\n(a|+\n(#^-1v)>\n(#- .nr #- +(\n(a|+\n(#^-\n(#--1v)
2969.ta \n(80u
2970.nr 31 \n(.f
2971.nr 35 1m
2972\&\h'|\n(40u'
2973.mk ##
2974.nr 31 \n(##
2975.sp |\n(##u-1v
2976.nr 37 \n(40u
2977.in +\n(37u
2978.a+
2979.in -\n(37u
2980.mk 32
2981.if \n(32>\n(31 .nr 31 \n(32
2982.sp |\n(31u
2983.fc
2984.nr T. 1
2985.T# 1
2986.35
2987.rm a+
2988.TE
2989.if \n-(b.=0 .nr c. \n(.c-\n(d.-22
2990
2991.LP
2992.SS
2993Class and Interface Documentation Tags
2994.LP
2995.LP
2996The following are tags that can appear in the documentation comment for a class or interface. The \f2@serial\fP tag can only be used here with the \f2include\fP or \f2exclude\fP argument.
2997.LP
2998.LP
2999.TS
3000.if \n+(b.=1 .nr d. \n(.c-\n(c.-1
3001.de 35
3002.ps \n(.s
3003.vs \n(.vu
3004.in \n(.iu
3005.if \n(.u .fi
3006.if \n(.j .ad
3007.if \n(.j=0 .na
3008..
3009.nf
3010.nr #~ 0
3011.if n .nr #~ 0.6n
3012.ds #d .d
3013.if \(ts\n(.z\(ts\(ts .ds #d nl
3014.fc
3015.nr 33 \n(.s
3016.rm 80
3017.nr 34 \n(.lu
3018.eo
3019.am 80
3020.br
3021.di a+
3022.35
3023.ft \n(.f
3024.ll \n(34u*1u/2u
3025.if \n(.l<\n(80 .ll \n(80u
3026.in 0
3027\f2@see\fP
3028.br
3029\f2@since\fP
3030.br
3031\f2@deprecated\fP
3032.br
3033\f2@serial\fP
3034.br
3035\f2@author\fP
3036.br
3037\f2@version\fP
3038.br
3039\f2{@link}\fP
3040.br
3041\f2{@linkplain}\fP
3042.br
3043\f2{@docRoot}\fP
3044.br
3045.di
3046.nr a| \n(dn
3047.nr a- \n(dl
3048..
3049.ec \
3050.35
3051.nf
3052.ll \n(34u
3053.nr 80 0
3054.nr 38 \w\f3Class/Interface Tags\fP
3055.if \n(80<\n(38 .nr 80 \n(38
3056.80
3057.rm 80
3058.nr 38 \n(a-
3059.if \n(80<\n(38 .nr 80 \n(38
3060.35
3061.nf
3062.ll \n(34u
3063.nr 38 1n
3064.nr 79 0
3065.nr 40 \n(79+(0*\n(38)
3066.nr 80 +\n(40
3067.nr TW \n(80
tbell16c34dd2009-05-04 18:28:26 -07003068.if t .if \n(TW>\n(.li .tm Table at line 2029 file Input is too wide - \n(TW units
duke6e45e102007-12-01 00:00:00 +00003069.fc  
3070.nr #T 0-1
3071.nr #a 0-1
3072.eo
3073.de T#
3074.ds #d .d
3075.if \(ts\n(.z\(ts\(ts .ds #d nl
3076.mk ##
3077.nr ## -1v
3078.ls 1
3079.ls
3080..
3081.ec
3082.ta \n(80u
3083.nr 31 \n(.f
3084.nr 35 1m
3085\&\h'|\n(40u'\f3Class/Interface Tags\fP
3086.ne \n(a|u+\n(.Vu
3087.if (\n(a|+\n(#^-1v)>\n(#- .nr #- +(\n(a|+\n(#^-\n(#--1v)
3088.ta \n(80u
3089.nr 31 \n(.f
3090.nr 35 1m
3091\&\h'|\n(40u'
3092.mk ##
3093.nr 31 \n(##
3094.sp |\n(##u-1v
3095.nr 37 \n(40u
3096.in +\n(37u
3097.a+
3098.in -\n(37u
3099.mk 32
3100.if \n(32>\n(31 .nr 31 \n(32
3101.sp |\n(31u
3102.fc
3103.nr T. 1
3104.T# 1
3105.35
3106.rm a+
3107.TE
3108.if \n-(b.=0 .nr c. \n(.c-\n(d.-24
3109
3110.LP
3111\f3An example of a class comment:\fP
3112.LP
3113.nf
3114\f3
3115.fl
3116/**
3117.fl
3118 * A class representing a window on the screen.
3119.fl
3120 * For example:
3121.fl
3122 * <pre>
3123.fl
3124 * Window win = new Window(parent);
3125.fl
3126 * win.show();
3127.fl
3128 * </pre>
3129.fl
3130 *
3131.fl
3132 * @author Sami Shaio
3133.fl
3134 * @version 1.13, 06/08/06
3135.fl
3136 * @see java.awt.BaseWindow
3137.fl
3138 * @see java.awt.Button
3139.fl
3140 */
3141.fl
3142class Window extends BaseWindow {
3143.fl
3144 ...
3145.fl
3146}
3147.fl
3148\fP
3149.fi
3150
3151.LP
3152.SS
3153Field Documentation Tags
3154.LP
3155.LP
3156The following are the tags that can appear in the documentation comment for a field.
3157.LP
3158.LP
3159.TS
3160.if \n+(b.=1 .nr d. \n(.c-\n(c.-1
3161.de 35
3162.ps \n(.s
3163.vs \n(.vu
3164.in \n(.iu
3165.if \n(.u .fi
3166.if \n(.j .ad
3167.if \n(.j=0 .na
3168..
3169.nf
3170.nr #~ 0
3171.if n .nr #~ 0.6n
3172.ds #d .d
3173.if \(ts\n(.z\(ts\(ts .ds #d nl
3174.fc
3175.nr 33 \n(.s
3176.rm 80
3177.nr 34 \n(.lu
3178.eo
3179.am 80
3180.br
3181.di a+
3182.35
3183.ft \n(.f
3184.ll \n(34u*1u/2u
3185.if \n(.l<\n(80 .ll \n(80u
3186.in 0
3187\f2@see\fP
3188.br
3189\f2@since\fP
3190.br
3191\f2@deprecated\fP
3192.br
3193\f2@serial\fP
3194.br
3195\f2@serialField\fP
3196.br
3197\f2{@link}\fP
3198.br
3199\f2{@linkplain}\fP
3200.br
3201\f2{@docRoot}\fP
3202.br
3203\f2{@value}\fP
3204.br
3205.di
3206.nr a| \n(dn
3207.nr a- \n(dl
3208..
3209.ec \
3210.35
3211.nf
3212.ll \n(34u
3213.nr 80 0
3214.nr 38 \w\f3Field Tags\fP
3215.if \n(80<\n(38 .nr 80 \n(38
3216.80
3217.rm 80
3218.nr 38 \n(a-
3219.if \n(80<\n(38 .nr 80 \n(38
3220.35
3221.nf
3222.ll \n(34u
3223.nr 38 1n
3224.nr 79 0
3225.nr 40 \n(79+(0*\n(38)
3226.nr 80 +\n(40
3227.nr TW \n(80
tbell16c34dd2009-05-04 18:28:26 -07003228.if t .if \n(TW>\n(.li .tm Table at line 2104 file Input is too wide - \n(TW units
duke6e45e102007-12-01 00:00:00 +00003229.fc  
3230.nr #T 0-1
3231.nr #a 0-1
3232.eo
3233.de T#
3234.ds #d .d
3235.if \(ts\n(.z\(ts\(ts .ds #d nl
3236.mk ##
3237.nr ## -1v
3238.ls 1
3239.ls
3240..
3241.ec
3242.ta \n(80u
3243.nr 31 \n(.f
3244.nr 35 1m
3245\&\h'|\n(40u'\f3Field Tags\fP
3246.ne \n(a|u+\n(.Vu
3247.if (\n(a|+\n(#^-1v)>\n(#- .nr #- +(\n(a|+\n(#^-\n(#--1v)
3248.ta \n(80u
3249.nr 31 \n(.f
3250.nr 35 1m
3251\&\h'|\n(40u'
3252.mk ##
3253.nr 31 \n(##
3254.sp |\n(##u-1v
3255.nr 37 \n(40u
3256.in +\n(37u
3257.a+
3258.in -\n(37u
3259.mk 32
3260.if \n(32>\n(31 .nr 31 \n(32
3261.sp |\n(31u
3262.fc
3263.nr T. 1
3264.T# 1
3265.35
3266.rm a+
3267.TE
3268.if \n-(b.=0 .nr c. \n(.c-\n(d.-24
3269
3270.LP
3271\f3An example of a field comment:\fP
3272.LP
3273.nf
3274\f3
3275.fl
3276 /**
3277.fl
3278 * The X\-coordinate of the component.
3279.fl
3280 *
3281.fl
3282 * @see #getLocation()
3283.fl
3284 */
3285.fl
3286 int x = 1263732;
3287.fl
3288\fP
3289.fi
3290
3291.LP
3292.SS
3293Constructor and Method Documentation Tags
3294.LP
3295.LP
3296The following are the tags that can appear in the documentation comment for a constructor or method, except for \f2@return\fP, which cannot appear in a constructor, and \f2{@inheritDoc}\fP, which has certain restrictions. The \f2@serialData\fP tag can only be used in the doc comment for certain serialization methods.
3297.LP
3298.LP
3299.TS
3300.if \n+(b.=1 .nr d. \n(.c-\n(c.-1
3301.de 35
3302.ps \n(.s
3303.vs \n(.vu
3304.in \n(.iu
3305.if \n(.u .fi
3306.if \n(.j .ad
3307.if \n(.j=0 .na
3308..
3309.nf
3310.nr #~ 0
3311.if n .nr #~ 0.6n
3312.ds #d .d
3313.if \(ts\n(.z\(ts\(ts .ds #d nl
3314.fc
3315.nr 33 \n(.s
3316.rm 80
3317.nr 34 \n(.lu
3318.eo
3319.am 80
3320.br
3321.di a+
3322.35
3323.ft \n(.f
3324.ll \n(34u*1u/2u
3325.if \n(.l<\n(80 .ll \n(80u
3326.in 0
3327\f2@see\fP
3328.br
3329\f2@since\fP
3330.br
3331\f2@deprecated\fP
3332.br
3333\f2@param\fP
3334.br
3335\f2@return\fP
3336.br
3337\f2@throws\fP and \f2@exception\fP
3338.br
3339\f2@serialData\fP
3340.br
3341\f2{@link}\fP
3342.br
3343\f2{@linkplain}\fP
3344.br
3345\f2{@inheritDoc}\fP
3346.br
3347\f2{@docRoot}\fP
3348.br
3349.di
3350.nr a| \n(dn
3351.nr a- \n(dl
3352..
3353.ec \
3354.35
3355.nf
3356.ll \n(34u
3357.nr 80 0
3358.nr 38 \w\f3Method/Constructor Tags\fP
3359.if \n(80<\n(38 .nr 80 \n(38
3360.80
3361.rm 80
3362.nr 38 \n(a-
3363.if \n(80<\n(38 .nr 80 \n(38
3364.35
3365.nf
3366.ll \n(34u
3367.nr 38 1n
3368.nr 79 0
3369.nr 40 \n(79+(0*\n(38)
3370.nr 80 +\n(40
3371.nr TW \n(80
tbell16c34dd2009-05-04 18:28:26 -07003372.if t .if \n(TW>\n(.li .tm Table at line 2163 file Input is too wide - \n(TW units
duke6e45e102007-12-01 00:00:00 +00003373.fc  
3374.nr #T 0-1
3375.nr #a 0-1
3376.eo
3377.de T#
3378.ds #d .d
3379.if \(ts\n(.z\(ts\(ts .ds #d nl
3380.mk ##
3381.nr ## -1v
3382.ls 1
3383.ls
3384..
3385.ec
3386.ta \n(80u
3387.nr 31 \n(.f
3388.nr 35 1m
3389\&\h'|\n(40u'\f3Method/Constructor Tags\fP
3390.ne \n(a|u+\n(.Vu
3391.if (\n(a|+\n(#^-1v)>\n(#- .nr #- +(\n(a|+\n(#^-\n(#--1v)
3392.ta \n(80u
3393.nr 31 \n(.f
3394.nr 35 1m
3395\&\h'|\n(40u'
3396.mk ##
3397.nr 31 \n(##
3398.sp |\n(##u-1v
3399.nr 37 \n(40u
3400.in +\n(37u
3401.a+
3402.in -\n(37u
3403.mk 32
3404.if \n(32>\n(31 .nr 31 \n(32
3405.sp |\n(31u
3406.fc
3407.nr T. 1
3408.T# 1
3409.35
3410.rm a+
3411.TE
3412.if \n-(b.=0 .nr c. \n(.c-\n(d.-28
3413
3414.LP
3415\f3An example of a method doc comment:\fP
3416.LP
3417.nf
3418\f3
3419.fl
3420 /**
3421.fl
3422 * Returns the character at the specified index. An index
3423.fl
3424 * ranges from <code>0</code> to <code>length() \- 1</code>.
3425.fl
3426 *
3427.fl
3428 * @param index the index of the desired character.
3429.fl
3430 * @return the desired character.
3431.fl
3432 * @exception StringIndexOutOfRangeException
3433.fl
3434 * if the index is not in the range <code>0</code>
3435.fl
3436 * to <code>length()\-1</code>.
3437.fl
3438 * @see java.lang.Character#charValue()
3439.fl
3440 */
3441.fl
3442 public char charAt(int index) {
3443.fl
3444 ...
3445.fl
3446 }
3447.fl
3448\fP
3449.fi
3450.RE
3451
3452.LP
3453.SH "OPTIONS"
3454.LP
tbell16c34dd2009-05-04 18:28:26 -07003455
3456.LP
duke6e45e102007-12-01 00:00:00 +00003457.LP
3458The javadoc tool uses doclets to determine its output. The Javadoc tool uses the default standard doclet unless a custom doclet is specified with the \-doclet option. The Javadoc tool provides a set of command\-line options that can be used with any doclet \-\- these options are described below under the sub\-heading Javadoc Options. The standard doclet provides an additional set of command\-line options that are described below under the sub\-heading Options Provided by the Standard Doclet. All option names are case\-insensitive, though their arguments can be case\-sensitive.
3459.LP
3460.LP
3461The options are:
3462.LP
3463.RS 3
3464
3465.LP
3466.LP
3467.TS
3468.if \n+(b.=1 .nr d. \n(.c-\n(c.-1
3469.de 35
3470.ps \n(.s
3471.vs \n(.vu
3472.in \n(.iu
3473.if \n(.u .fi
3474.if \n(.j .ad
3475.if \n(.j=0 .na
3476..
3477.nf
3478.nr #~ 0
3479.if n .nr #~ 0.6n
3480.ds #d .d
3481.if \(ts\n(.z\(ts\(ts .ds #d nl
3482.fc
3483.nr 33 \n(.s
3484.rm 80 81 82
3485.nr 34 \n(.lu
3486.eo
3487.am 80
3488.br
3489.di a+
3490.35
3491.ft \n(.f
3492.ll \n(34u*1u/4u
3493.if \n(.l<\n(80 .ll \n(80u
3494.in 0
3495\-\f21.1\fP
3496.br
3497\-author
3498.br
3499\-\f2bootclasspath\fP
3500.br
3501\-bottom
3502.br
3503\-\f2breakiterator\fP
3504.br
3505\-charset
3506.br
3507\-\f2classpath\fP
3508.br
3509\-d
3510.br
3511\-docencoding
3512.br
3513\-docfilessubdirs
3514.br
3515\-\f2doclet\fP
3516.br
3517\-\f2docletpath\fP
3518.br
3519\-doctitle
3520.br
3521\-\f2encoding\fP
3522.br
3523\-\f2exclude\fP
3524.br
3525\-excludedocfilessubdir
3526.br
3527\-\f2extdirs\fP
3528.br
3529\-footer
3530.br
3531\-group
3532.br
3533.br
3534.di
3535.nr a| \n(dn
3536.nr a- \n(dl
3537..
3538.ec \
3539.eo
3540.am 81
3541.br
3542.di b+
3543.35
3544.ft \n(.f
3545.ll \n(34u*1u/4u
3546.if \n(.l<\n(81 .ll \n(81u
3547.in 0
3548\-header
3549.br
3550\-\f2help\fP
3551.br
3552\-helpfile
3553.br
3554\-\f2J\fP
3555.br
3556\-keywords
3557.br
3558\-link
3559.br
3560\-linkoffline
3561.br
3562\-linksource
3563.br
3564\-\f2locale\fP
3565.br
3566\-nocomment
3567.br
3568\-nodeprecated
3569.br
3570\-nodeprecatedlist
3571.br
3572\-nohelp
3573.br
3574\-noindex
3575.br
3576\-nonavbar
3577.br
3578\-noqualifier
3579.br
3580\-nosince
3581.br
3582\-notimestamp
3583.br
3584\-notree
3585.br
3586\-\f2overview\fP
3587.br
3588\-\f2package\fP
3589.br
3590.br
3591.di
3592.nr b| \n(dn
3593.nr b- \n(dl
3594..
3595.ec \
3596.eo
3597.am 82
3598.br
3599.di c+
3600.35
3601.ft \n(.f
3602.ll \n(34u*1u/4u
3603.if \n(.l<\n(82 .ll \n(82u
3604.in 0
3605\-\f2private\fP
3606.br
3607\-\f2protected\fP
3608.br
3609\-\f2public\fP
3610.br
3611\-\f2quiet\fP
3612.br
3613\-serialwarn
3614.br
3615\-\f2source\fP
3616.br
3617\-\f2sourcepath\fP
3618.br
3619\-splitindex
3620.br
3621\-stylesheetfile
3622.br
3623\-\f2subpackages\fP
3624.br
3625\-tag
3626.br
3627\-taglet
3628.br
3629\-tagletpath
3630.br
3631\-title
3632.br
3633\-use
3634.br
3635\-\f2verbose\fP
3636.br
3637\-version
3638.br
3639\-windowtitle
3640.br
3641.br
3642.di
3643.nr c| \n(dn
3644.nr c- \n(dl
3645..
3646.ec \
3647.35
3648.nf
3649.ll \n(34u
3650.nr 80 0
3651.80
3652.rm 80
3653.nr 38 \n(a-
3654.if \n(80<\n(38 .nr 80 \n(38
3655.nr 81 0
3656.81
3657.rm 81
3658.nr 38 \n(b-
3659.if \n(81<\n(38 .nr 81 \n(38
3660.nr 82 0
3661.82
3662.rm 82
3663.nr 38 \n(c-
3664.if \n(82<\n(38 .nr 82 \n(38
3665.35
3666.nf
3667.ll \n(34u
3668.nr 38 1n
3669.nr 79 0
3670.nr 40 \n(79+(0*\n(38)
3671.nr 80 +\n(40
3672.nr 41 \n(80+(3*\n(38)
3673.nr 81 +\n(41
3674.nr 42 \n(81+(3*\n(38)
3675.nr 82 +\n(42
3676.nr TW \n(82
tbell16c34dd2009-05-04 18:28:26 -07003677.if t .if \n(TW>\n(.li .tm Table at line 2341 file Input is too wide - \n(TW units
duke6e45e102007-12-01 00:00:00 +00003678.fc  
3679.nr #T 0-1
3680.nr #a 0-1
3681.eo
3682.de T#
3683.ds #d .d
3684.if \(ts\n(.z\(ts\(ts .ds #d nl
3685.mk ##
3686.nr ## -1v
3687.ls 1
3688.ls
3689..
3690.ec
3691.ne \n(a|u+\n(.Vu
3692.ne \n(b|u+\n(.Vu
3693.ne \n(c|u+\n(.Vu
3694.if (\n(a|+\n(#^-1v)>\n(#- .nr #- +(\n(a|+\n(#^-\n(#--1v)
3695.if (\n(b|+\n(#^-1v)>\n(#- .nr #- +(\n(b|+\n(#^-\n(#--1v)
3696.if (\n(c|+\n(#^-1v)>\n(#- .nr #- +(\n(c|+\n(#^-\n(#--1v)
3697.ta \n(80u \n(81u \n(82u
3698.nr 31 \n(.f
3699.nr 35 1m
3700\&\h'|\n(40u'\h'|\n(41u'\h'|\n(42u'
3701.mk ##
3702.nr 31 \n(##
3703.sp |\n(##u-1v
3704.nr 37 \n(40u
3705.in +\n(37u
3706.a+
3707.in -\n(37u
3708.mk 32
3709.if \n(32>\n(31 .nr 31 \n(32
3710.sp |\n(##u-1v
3711.nr 37 \n(41u
3712.in +\n(37u
3713.b+
3714.in -\n(37u
3715.mk 32
3716.if \n(32>\n(31 .nr 31 \n(32
3717.sp |\n(##u-1v
3718.nr 37 \n(42u
3719.in +\n(37u
3720.c+
3721.in -\n(37u
3722.mk 32
3723.if \n(32>\n(31 .nr 31 \n(32
3724.sp |\n(31u
3725.fc
3726.nr T. 1
3727.T# 1
3728.35
3729.rm a+
3730.rm b+
3731.rm c+
3732.TE
3733.if \n-(b.=0 .nr c. \n(.c-\n(d.-123
3734
3735.LP
3736.RE
3737.LP
3738Options shown in \f2italic\fP are the Javadoc core options, which are provided by the front end of the Javadoc tool and are available to all doclets. The standard doclet itself provides the non\-italic options.
3739.LP
3740.SS
3741Javadoc Options
3742.LP
3743.RS 3
3744.TP 3
3745\-overview \ path/filename
3746Specifies that javadoc should retrieve the text for the overview documentation from the "source" file specified by \f2path/filename\fP and place it on the Overview page (\f2overview\-summary.html\fP). The \f2path/filename\fP is relative to the \f2\-sourcepath\fP.
3747.LP
3748While you can use any name you want for \f2filename\fP and place it anywhere you want for \f2path\fP, a typical thing to do is to name it \f2overview.html\fP and place it in the source tree at the directory that contains the topmost package directories. In this location, no \f2path\fP is needed when documenting packages, since \f2\-sourcepath\fP will point to this file. For example, if the source tree for the \f2java.lang\fP package is \f2/src/classes/java/lang/\fP, then you could place the overview file at \f2/src/classes/overview.html\fP. See Real World Example.
3749.LP
3750For information about the file specified by \f2path/filename\fP, see overview comment file.
3751.LP
3752Note that the overview page is created only if you pass into javadoc two or more package names. For further explanation, see HTML Frames.)
3753.LP
3754The title on the overview page is set by \f2\-doctitle\fP.
3755.LP
3756.TP 3
3757\-public
3758Shows only public classes and members.
3759.LP
3760.TP 3
3761\-protected
3762Shows only protected and public classes and members. This is the default.
3763.LP
3764.TP 3
3765\-package
3766Shows only package, protected, and public classes and members.
3767.LP
3768.TP 3
3769\-private
3770Shows all classes and members.
3771.LP
3772.TP 3
3773\-help
3774Displays the online help, which lists these javadoc and doclet command line options.
3775.LP
3776.TP 3
3777\-doclet\ class
3778Specifies the class file that starts the doclet used in generating the documentation. Use the fully\-qualified name. This doclet defines the content and formats the output. If the \f4\-doclet\fP option is not used, javadoc uses the standard doclet for generating the default HTML format. This class must contain the \f2start(Root)\fP method. The path to this starting class is defined by the \f2\-docletpath\fP option.
3779.LP
3780For example, to call the MIF doclet, use:
3781.nf
3782\f3
3783.fl
3784 \-doclet com.sun.tools.doclets.mif.MIFDoclet
3785.fl
3786\fP
3787.fi
3788.LP
tbell16c34dd2009-05-04 18:28:26 -07003789For full, working examples of running a particular doclet, see the
duke6e45e102007-12-01 00:00:00 +00003790.na
tbell16c34dd2009-05-04 18:28:26 -07003791\f2MIF Doclet documentation\fP @
duke6e45e102007-12-01 00:00:00 +00003792.fi
tbell16c34dd2009-05-04 18:28:26 -07003793http://java.sun.com/j2se/javadoc/mifdoclet/docs/mifdoclet.html.
duke6e45e102007-12-01 00:00:00 +00003794.LP
3795.TP 3
3796\-docletpath\ classpathlist
3797Specifies the path to the doclet starting class file (specified with the \f2\-doclet\fP option) and any jar files it depends on. If the starting class file is in a jar file, then this specifies the path to that jar file, as shown in the example below. You can specify an absolute path or a path relative to the current directory. If \f2classpathlist\fP contains multiple paths or jar files, they should be separated with a colon (:) on Solaris and a semi\-colon (;) on Windows. This option is not necessary if the doclet starting class is already in the search path.
3798.LP
3799Example of path to jar file that contains the starting doclet class file. Notice the jar filename is included.
3800.nf
3801\f3
3802.fl
3803 \-docletpath /home/user/mifdoclet/lib/mifdoclet.jar
3804.fl
3805\fP
3806.fi
3807Example of path to starting doclet class file. Notice the class filename is omitted.
3808.nf
3809\f3
3810.fl
3811 \-docletpath /home/user/mifdoclet/classes/com/sun/tools/doclets/mif/
3812.fl
3813\fP
3814.fi
tbell16c34dd2009-05-04 18:28:26 -07003815For full, working examples of running a particular doclet, see the
duke6e45e102007-12-01 00:00:00 +00003816.na
tbell16c34dd2009-05-04 18:28:26 -07003817\f2MIF Doclet documentation\fP @
duke6e45e102007-12-01 00:00:00 +00003818.fi
tbell16c34dd2009-05-04 18:28:26 -07003819http://java.sun.com/j2se/javadoc/mifdoclet/docs/mifdoclet.html.
duke6e45e102007-12-01 00:00:00 +00003820.LP
3821.TP 3
3822\-1.1
3823\f2This feature has been removed from Javadoc 1.4. There is no replacement for it. This option created documentation with the appearance and functionality of documentation generated by Javadoc 1.1 (it never supported nested classes). If you need this option, use Javadoc 1.2 or 1.3 instead.\fP
3824.LP
3825.TP 3
3826\-source release
3827Specifies the version of source code accepted. The following values for \f2release\fP are allowed:
3828.LP
3829.TS
3830.if \n+(b.=1 .nr d. \n(.c-\n(c.-1
3831.de 35
3832.ps \n(.s
3833.vs \n(.vu
3834.in \n(.iu
3835.if \n(.u .fi
3836.if \n(.j .ad
3837.if \n(.j=0 .na
3838..
3839.nf
3840.nr #~ 0
3841.if n .nr #~ 0.6n
3842.ds #d .d
3843.if \(ts\n(.z\(ts\(ts .ds #d nl
3844.fc
3845.nr 33 \n(.s
3846.rm 80 81
3847.nr 34 \n(.lu
3848.eo
3849.am 81
3850.br
3851.di a+
3852.35
3853.ft \n(.f
3854.ll \n(34u*1u/3u
3855.if \n(.l<\n(81 .ll \n(81u
3856.in 0
3857javadoc accepts code containing generics and other language features introduced in JDK 1.5. The compiler defaults to the 1.5 behavior if the \f3\-source\fP flag is not used.
3858.br
3859.di
3860.nr a| \n(dn
3861.nr a- \n(dl
3862..
3863.ec \
3864.eo
3865.am 81
3866.br
3867.di b+
3868.35
3869.ft \n(.f
3870.ll \n(34u*1u/3u
3871.if \n(.l<\n(81 .ll \n(81u
3872.in 0
3873javadoc accepts code containing assertions, which were introduced in JDK 1.4.
3874.br
3875.di
3876.nr b| \n(dn
3877.nr b- \n(dl
3878..
3879.ec \
3880.eo
3881.am 81
3882.br
3883.di c+
3884.35
3885.ft \n(.f
3886.ll \n(34u*1u/3u
3887.if \n(.l<\n(81 .ll \n(81u
3888.in 0
3889javadoc does \f2not\fP support assertions, generics, or other language features introduced after JDK 1.3.
3890.br
3891.di
3892.nr c| \n(dn
3893.nr c- \n(dl
3894..
3895.ec \
3896.35
3897.nf
3898.ll \n(34u
3899.nr 80 0
3900.nr 31 0
3901.nr 32 0
3902.nr 38 \w\f31
3903.if \n(31<\n(38 .nr 31 \n(38
3904.nr 38 \w.5\fP
3905.if \n(32<\n(38 .nr 32 \n(38
3906.nr 38 \w\f31
3907.if \n(31<\n(38 .nr 31 \n(38
3908.nr 38 \w.4\fP
3909.if \n(32<\n(38 .nr 32 \n(38
3910.nr 38 \w\f31
3911.if \n(31<\n(38 .nr 31 \n(38
3912.nr 38 \w.3\fP
3913.if \n(32<\n(38 .nr 32 \n(38
3914.80
3915.rm 80
3916.nr 60 \n(31
3917.nr 38 \n(60+\n(32
3918.if \n(38>\n(80 .nr 80 \n(38
3919.if \n(38<\n(80 .nr 60 +(\n(80-\n(38)/2
3920.nr 81 0
3921.81
3922.rm 81
3923.nr 38 \n(a-
3924.if \n(81<\n(38 .nr 81 \n(38
3925.nr 38 \n(b-
3926.if \n(81<\n(38 .nr 81 \n(38
3927.nr 38 \n(c-
3928.if \n(81<\n(38 .nr 81 \n(38
3929.35
3930.nf
3931.ll \n(34u
3932.nr 38 1n
3933.nr 79 0
3934.nr 40 \n(79+(0*\n(38)
3935.nr 80 +\n(40
3936.nr 60 +\n(40
3937.nr 41 \n(80+(3*\n(38)
3938.nr 81 +\n(41
3939.nr TW \n(81
tbell16c34dd2009-05-04 18:28:26 -07003940.if t .if \n(TW>\n(.li .tm Table at line 2451 file Input is too wide - \n(TW units
duke6e45e102007-12-01 00:00:00 +00003941.fc  
3942.nr #T 0-1
3943.nr #a 0-1
3944.eo
3945.de T#
3946.ds #d .d
3947.if \(ts\n(.z\(ts\(ts .ds #d nl
3948.mk ##
3949.nr ## -1v
3950.ls 1
3951.ls
3952..
3953.ec
3954.ne \n(a|u+\n(.Vu
3955.if (\n(a|+\n(#^-1v)>\n(#- .nr #- +(\n(a|+\n(#^-\n(#--1v)
3956.ta \n(60u \n(80u \n(81u
3957.nr 31 \n(.f
3958.nr 35 1m
3959\&\h'|\n(40u'\f31.5\fP\h'|\n(41u'
3960.mk ##
3961.nr 31 \n(##
3962.sp |\n(##u-1v
3963.nr 37 \n(41u
3964.in +\n(37u
3965.a+
3966.in -\n(37u
3967.mk 32
3968.if \n(32>\n(31 .nr 31 \n(32
3969.sp |\n(31u
3970.ne \n(b|u+\n(.Vu
3971.if (\n(b|+\n(#^-1v)>\n(#- .nr #- +(\n(b|+\n(#^-\n(#--1v)
3972.ta \n(60u \n(80u \n(81u
3973.nr 31 \n(.f
3974.nr 35 1m
3975\&\h'|\n(40u'\f31.4\fP\h'|\n(41u'
3976.mk ##
3977.nr 31 \n(##
3978.sp |\n(##u-1v
3979.nr 37 \n(41u
3980.in +\n(37u
3981.b+
3982.in -\n(37u
3983.mk 32
3984.if \n(32>\n(31 .nr 31 \n(32
3985.sp |\n(31u
3986.ne \n(c|u+\n(.Vu
3987.if (\n(c|+\n(#^-1v)>\n(#- .nr #- +(\n(c|+\n(#^-\n(#--1v)
3988.ta \n(60u \n(80u \n(81u
3989.nr 31 \n(.f
3990.nr 35 1m
3991\&\h'|\n(40u'\f31.3\fP\h'|\n(41u'
3992.mk ##
3993.nr 31 \n(##
3994.sp |\n(##u-1v
3995.nr 37 \n(41u
3996.in +\n(37u
3997.c+
3998.in -\n(37u
3999.mk 32
4000.if \n(32>\n(31 .nr 31 \n(32
4001.sp |\n(31u
4002.fc
4003.nr T. 1
4004.T# 1
4005.35
4006.rm a+
4007.rm b+
4008.rm c+
4009.TE
4010.if \n-(b.=0 .nr c. \n(.c-\n(d.-14
4011.LP
4012Use the value of \f2release\fP corresponding to that used when compiling the code with javac.
4013.LP
4014.TP 3
4015\-sourcepath\ sourcepathlist
4016Specifies the search paths for finding source files (\f2.java\fP) when passing package names or \f2\-subpackages\fP into the \f2javadoc\fP command. The \f2sourcepathlist\fP can contain multiple paths by separating them with a colon (\f2:\fP). The Javadoc tool will search in all subdirectories of the specified paths. Note that this option is not only used to locate the source files being documented, but also to find source files that are not being documented but whose comments are inherited by the source files being documented.
4017.LP
4018Note that you can use the \f2\-sourcepath\fP option only when passing package names into the javadoc command \-\- it will not locate \f2.java\fP files passed into the \f2javadoc\fP command. (To locate \f2.java\fP files, cd to that directory or include the path ahead of each file, as shown at Documenting One or More Classes.) If \f2\-sourcepath\fP is omitted, javadoc uses the class path to find the source files (see \-classpath). Therefore, the default \-sourcepath is the value of class path. If \-classpath is omitted and you are passing package names into javadoc, it looks in the current directory (and subdirectories) for the source files.
4019.LP
4020Set \f2sourcepathlist\fP to the root directory of the source tree for the package you are documenting. For example, suppose you want to document a package called \f2com.mypackage\fP whose source files are located at:
4021.nf
4022\f3
4023.fl
4024 /home/user/src/com/mypackage/*.java
4025.fl
4026\fP
4027.fi
4028In this case you would specify the \f2sourcepath\fP to \f2/home/user/src\fP, the directory that contains \f2com/mypackage\fP, and then supply the package name \f2com.mypackage\fP:
4029.nf
4030\f3
4031.fl
4032 % \fP\f3javadoc \-sourcepath /home/user/src/ com.mypackage\fP
4033.fl
4034.fi
4035This is easy to remember by noticing that if you concatenate the value of sourcepath and the package name together and change the dot to a slash "/", you end up with the full path to the package: \f2/home/user/src/com/mypackage\fP.
4036.LP
4037To point to two source paths:
4038.nf
4039\f3
4040.fl
4041 % \fP\f3javadoc \-sourcepath /home/user1/src:/home/user2/src com.mypackage\fP
4042.fl
4043.fi
4044.LP
4045.TP 3
4046\-classpath\ classpathlist
tbell16c34dd2009-05-04 18:28:26 -07004047Specifies the paths where javadoc will look for referenced classes (\f2.class\fP files) \-\- these are the documented classes plus any classes referenced by those classes. The \f2classpathlist\fP can contain multiple paths by separating them with a colon (\f2:\fP). The Javadoc tool will search in all subdirectories of the specified paths. Follow the instructions in
4048.na
4049\f2class path\fP @
4050.fi
4051http://java.sun.com/javase/6/docs/technotes/tools/index.html#general documentation for specifying \f2classpathlist\fP.
duke6e45e102007-12-01 00:00:00 +00004052.LP
4053If \f2\-sourcepath\fP is omitted, the Javadoc tool uses \f2\-classpath\fP to find the source files as well as class files (for backward compatibility). Therefore, if you want to search for source and class files in separate paths, use both \f2\-sourcepath\fP and \f2\-classpath\fP.
4054.LP
4055For example, if you want to document \f2com.mypackage\fP, whose source files reside in the directory \f2/home/user/src/com/mypackage\fP, and if this package relies on a library in \f2/home/user/lib\fP, you would specify:
4056.nf
4057\f3
4058.fl
4059 % \fP\f3javadoc \-classpath /home/user/lib \-sourcepath /home/user/src com.mypackage\fP
4060.fl
4061.fi
4062As with other tools, if you do not specify \f2\-classpath\fP, the Javadoc tool uses the CLASSPATH environment variable, if it is set. If both are not set, the Javadoc tool searches for classes from the current directory.
4063.LP
tbell16c34dd2009-05-04 18:28:26 -07004064For an in\-depth description of how the Javadoc tool uses \f2\-classpath\fP to find user classes as it relates to extension classes and bootstrap classes, see
4065.na
4066\f2How Classes Are Found\fP @
4067.fi
4068http://java.sun.com/javase/6/docs/technotes/tools/findingclasses.html.
duke6e45e102007-12-01 00:00:00 +00004069.LP
4070As a special convenience, a class path element containing a basename of \f2*\fP is considered equivalent to specifying a list of all the files in the directory with the extension \f2.jar\fP or \f2.JAR\fP (a java program cannot tell the difference between the two invocations).
4071.br
4072.br
4073For example, if directory \f2foo\fP contains \f2a.jar\fP and \f2b.JAR\fP, then the class path element \f2foo/*\fP is expanded to a \f2A.jar:b.JAR\fP, except that the order of jar files is unspecified. All jar files in the specified directory, even hidden ones, are included in the list. A classpath entry consisting simply of \f2*\fP expands to a list of all the jar files in the current directory. The \f2CLASSPATH\fP environment variable, where defined, will be similarly expanded. Any classpath wildcard expansion occurs before the Java virtual machine is started \-\- no Java program will ever see unexpanded wildcards except by querying the environment. For example; by invoking \f2System.getenv("CLASSPATH")\fP.
4074.LP
4075.TP 3
4076\-subpackages\ \ package1:package2:...
4077Generates documentation from source files in the specified packages and recursively in their subpackages. This option is useful when adding new subpackages to the source code, as they are automatically included. Each \f2package\fP argument is any top\-level subpackage (such as \f2java\fP) or fully qualified package (such as \f2javax.swing\fP) that does not need to contain source files. Arguments are separated by colons (on all operating systmes). Wildcards are not needed or allowed. Use \f2\-sourcepath\fP to specify where to find the packages. This option is smart about not processing source files that are in the source tree but do not belong to the packages, as described at processing of source files.
4078.LP
4079For example:
4080.nf
4081\f3
4082.fl
4083 % \fP\f3javadoc \-d docs \-sourcepath /home/user/src \-subpackages java:javax.swing\fP
4084.fl
4085.fi
4086This command generates documentation for packages named "java" and "javax.swing" and all their subpackages.
4087.LP
4088You can use \f2\-subpackages\fP in conjunction with \f2\-exclude\fP to exclude specific packages.
4089.LP
4090.TP 3
4091\-exclude\ \ packagename1:packagename2:...
4092Unconditionally excludes the specified packages and their subpackages from the list formed by \f2\-subpackages\fP. It excludes those packages even if they would otherwise be included by some previous or later \f2\-subpackages\fP option. For example:
4093.nf
4094\f3
4095.fl
4096 % \fP\f3javadoc \-sourcepath /home/user/src \-subpackages java \-exclude java.net:java.lang\fP
4097.fl
4098.fi
4099would include \f2java.io\fP, \f2java.util\fP, and \f2java.math\fP (among others), but would exclude packages rooted at \f2java.net\fP and \f2java.lang\fP. Notice this excludes \f2java.lang.ref\fP, a subpackage of \f2java.lang\fP).
4100.LP
4101.TP 3
4102\-bootclasspath\ classpathlist
tbell16c34dd2009-05-04 18:28:26 -07004103Specifies the paths where the boot classes reside. These are nominally the Java platform classes. The bootclasspath is part of the search path the Javadoc tool will use to look up source and class files. See
4104.na
4105\f2How Classes Are Found\fP @
4106.fi
4107http://java.sun.com/javase/6/docs/technotes/tools/findingclasses.html#srcfiles. for more details. Separate directories in \f2classpathlist\fP with colons (:).
duke6e45e102007-12-01 00:00:00 +00004108.LP
4109.TP 3
4110\-extdirs\ dirlist
4111Specifies the directories where extension classes reside. These are any classes that use the Java Extension mechanism. The extdirs is part of the search path the Javadoc tool will use to look up source and class files. See \f2\-classpath\fP (above) for more details. Separate directories in \f2dirlist\fP with colons (:).
4112.LP
4113.TP 3
4114\-verbose
4115Provides more detailed messages while javadoc is running. Without the verbose option, messages appear for loading the source files, generating the documentation (one message per source file), and sorting. The verbose option causes the printing of additional messages specifying the number of milliseconds to parse each java source file.
4116.LP
4117.TP 3
4118\-quiet
4119Shuts off non\-error and non\-warning messages, leaving only the warnings and errors appear, making them easier to view. Also suppresses the version string.
4120.LP
4121.TP 3
4122\-breakiterator\
tbell16c34dd2009-05-04 18:28:26 -07004123Uses the internationalized sentence boundary of
4124.na
4125\f2java.text.BreakIterator\fP @
4126.fi
4127http://java.sun.com/javase/6/docs/api/java/text/BreakIterator.html to determine the end of the first sentence for English (all other locales already use \f2BreakIterator\fP), rather than an English language, locale\-specific algorithm. By \f2first sentence\fP, we mean the first sentence in the main description of a package, class or member. This sentence is copied to the package, class or member summary, and to the alphabetic index.
duke6e45e102007-12-01 00:00:00 +00004128.LP
4129From JDK 1.2 forward, the BreakIterator class is already used to determine the end of sentence for all languages but English. Therefore, the \f2\-breakiterator\fP option has no effect except for English from 1.2 forward. English has its own default algorithm:
4130.RS 3
4131.TP 2
4132o
4133English default sentence\-break algorithm \- Stops at a period followed by a space or a HTML block tag, such as \f2<P>\fP.
4134.TP 2
4135o
4136Breakiterator sentence\-break algorithm \- In general, stops at a period, question mark or exclamation mark followed by a space if the next word starts with a capital letter. This is meant to handle most abbreviations (such as "The serial no. is valid", but won't handle "Mr. Smith"). Doesn't stop at HTML tags or sentences that begin with numbers or symbols. Stops at the last period in "../filename", even if embedded in an HTML tag.
4137.RE
4138.RS 3
4139
4140.LP
4141.LP
4142NOTE: We have removed from 1.5.0 the breakiterator warning messages that were in 1.4.x and have left the default sentence\-break algorithm unchanged. That is, the \-breakiterator option is not the default in 1.5.0, nor do we expect it to become the default. This is a reversal from our former intention that the default would change in the "next major release" (1.5.0). This means if you have not modified your source code to eliminate the breakiterator warnings in 1.4.x, then you don't have to do anything, and the warnings go away starting with 1.5.0. The reason for this reversal is because any benefit to having breakiterator become the default would be outweighed by the incompatible source change it would require. We regret any extra work and confusion this has caused.
4143.LP
4144.RE
4145.TP 3
4146\-locale\ language_country_variant
4147.RS 3
4148.LP
4149\f3Important\fP \- The \f2\-locale\fP option must be placed \f2ahead\fP (to the left) of any options provided by the standard doclet or any other doclet. Otherwise, the navigation bars will appear in English. This is the only command\-line option that is order\-dependent.
4150.LP
4151.RE
4152.LP
4153Specifies the locale that javadoc uses when generating documentation. The argument is the name of the locale, as described in java.util.Locale documentation, such as \f2en_US\fP (English, United States) or \f2en_US_WIN\fP (Windows variant).
4154.LP
4155Specifying a locale causes javadoc to choose the resource files of that locale for messages (strings in the navigation bar, headings for lists and tables, help file contents, comments in stylesheet.css, and so forth). It also specifies the sorting order for lists sorted alphabetically, and the sentence separator to determine the end of the first sentence. It does not determine the locale of the doc comment text specified in the source files of the documented classes.
4156.LP
4157.TP 3
4158\-encoding\ name
4159Specifies the encoding name of the source files, such as \f2EUCJIS/SJIS\fP. If this option is not specified, the platform default converter is used.
4160.LP
4161Also see \-docencoding and \-charset.
4162.LP
4163.TP 3
4164\-Jflag
4165Passes \f2flag\fP directly to the runtime system java that runs javadoc. Notice there must be no space between the \f2J\fP and the \f2flag\fP. For example, if you need to ensure that the system sets aside 32 megabytes of memory in which to process the generated documentation, then you would call the \f2\-Xmx\fP option of java as follows (\f2\-Xms\fP is optional, as it only sets the size of initial memory, which is useful if you know the minimum amount of memory required):
4166.nf
4167\f3
4168.fl
4169 % \fP\f3javadoc \-J\-Xmx32m \-J\-Xms32m\fP \f3com.mypackage\fP
4170.fl
4171.fi
4172To tell what version of javadoc you are using, call the "\f2\-version\fP" option of java:
4173.nf
4174\f3
4175.fl
4176 % \fP\f3javadoc \-J\-version\fP
4177.fl
4178 java version "1.2"
4179.fl
4180 Classic VM (build JDK\-1.2\-V, green threads, sunwjit)
4181.fl
4182.fi
4183(The version number of the standard doclet appears in its output stream.)
4184.RE
4185.SS
4186Options Provided by the Standard Doclet
4187.LP
4188.RS 3
4189.TP 3
4190\-d\ directory
4191Specifies the destination directory where javadoc saves the generated HTML files. (The "d" means "destination.") Omitting this option causes the files to be saved to the current directory. The value \f2directory\fP can be absolute, or relative to the current working directory. As of 1.4, the destination directory is automatically created when javadoc is run.
4192.LP
4193For example, the following generates the documentation for the package \f2com.mypackage\fP and saves the results in the \f2/home/user/doc/\fP directory:
4194.nf
4195\f3
4196.fl
4197 % \fP\f3javadoc \-d /home/user/doc com.mypackage\fP
4198.fl
4199.fi
4200.LP
4201.TP 3
4202\-use
4203Includes one "Use" page for each documented class and package. The page describes what packages, classes, methods, constructors and fields use any API of the given class or package. Given class C, things that use class C would include subclasses of C, fields declared as C, methods that return C, and methods and constructors with parameters of type C.
4204.LP
tbell16c34dd2009-05-04 18:28:26 -07004205For example, let us look at what might appear on the "Use" page for String. The \f2getName()\fP method in the \f2java.awt.Font\fP class returns type \f2String\fP. Therefore, \f2getName()\fP uses \f2String\fP, and you will find that method on the "Use" page for \f2String\fP.
duke6e45e102007-12-01 00:00:00 +00004206.LP
4207Note that this documents only uses of the API, not the implementation. If a method uses \f2String\fP in its implementation but does not take a string as an argument or return a string, that is not considered a "use" of \f2String\fP.
4208.LP
4209You can access the generated "Use" page by first going to the class or package, then clicking on the "Use" link in the navigation bar.
4210.TP 3
4211\-version
4212Includes the @version text in the generated docs. This text is omitted by default. To tell what version of the Javadoc tool you are using, use the \f2\-J\-version\fP option.
4213.LP
4214.TP 3
4215\-author
4216Includes the @author text in the generated docs.
4217.LP
4218.TP 3
4219\-splitindex
4220Splits the index file into multiple files, alphabetically, one file per letter, plus a file for any index entries that start with non\-alphabetical characters.
4221.LP
4222.TP 3
4223\-windowtitle\ title
4224Specifies the title to be placed in the HTML <title> tag. This appears in the window title and in any browser bookmarks (favorite places) that someone creates for this page. This title should not contain any HTML tags, as the browser will not properly interpret them. Any internal quotation marks within \f2title\fP may have to be escaped. If \-windowtitle is omitted, the Javadoc tool uses the value of \-doctitle for this option.
4225.nf
4226\f3
4227.fl
tbell16c34dd2009-05-04 18:28:26 -07004228 % \fP\f3javadoc \-windowtitle "Java SE Platform" com.mypackage\fP
duke6e45e102007-12-01 00:00:00 +00004229.fl
4230.fi
4231.TP 3
4232\-doctitle\ title
4233Specifies the title to be placed near the top of the overview summary file. The title will be placed as a centered, level\-one heading directly beneath the upper navigation bar. The \f2title\fP may contain html tags and white space, though if it does, it must be enclosed in quotes. Any internal quotation marks within \f2title\fP may have to be escaped.
4234.nf
4235\f3
4236.fl
tbell16c34dd2009-05-04 18:28:26 -07004237 % \fP\f3javadoc \-doctitle "Java(TM)" com.mypackage\fP
duke6e45e102007-12-01 00:00:00 +00004238.fl
4239.fi
4240.TP 3
4241\-title\ title
4242\f3This option no longer exists.\fP It existed only in Beta versions of Javadoc 1.2. It has been renamed to \f2\-doctitle\fP. This option is being renamed to make it clear that it defines the document title rather than the window title.
4243.LP
4244.TP 3
4245\-header\ header
4246Specifies the header text to be placed at the top of each output file. The header will be placed to the right of the upper navigation bar. \f2header\fP may contain HTML tags and white space, though if it does, it must be enclosed in quotes. Any internal quotation marks within \f2header\fP may have to be escaped.
4247.nf
4248\f3
4249.fl
4250 % \fP\f3javadoc \-header "<b>Java 2 Platform </b><br>v1.4" com.mypackage\fP
4251.fl
4252.fi
4253.LP
4254.TP 3
4255\-footer\ footer
4256Specifies the footer text to be placed at the bottom of each output file. The footer will be placed to the right of the lower navigation bar. \f2footer\fP may contain html tags and white space, though if it does, it must be enclosed in quotes. Any internal quotation marks within \f2footer\fP may have to be escaped.
4257.LP
4258.TP 3
4259\-bottom\ text
4260Specifies the text to be placed at the bottom of each output file. The text will be placed at the bottom of the page, below the lower navigation bar. The \f2text\fP may contain HTML tags and white space, though if it does, it must be enclosed in quotes. Any internal quotation marks within \f2text\fP may have to be escaped.
4261.LP
4262.TP 3
4263\-link\ extdocURL
4264Creates links to existing javadoc\-generated documentation of external referenced classes. It takes one argument:
4265.LP
4266.RS 3
4267.TP 2
4268o
4269\f4extdocURL\fP is the absolute or relative URL of the directory containing the external javadoc\-generated documentation you want to link to. Examples are shown below. The package\-list file must be found in this directory (otherwise, use \f2\-linkoffline\fP). The Javadoc tool reads the package names from the \f2package\-list\fP file and then links to those packages at that URL. When the Javadoc tool is run, the \f2extdocURL\fP value is copied literally into the \f2<A HREF>\fP links that are created. Therefore, \f2extdocURL\fP must be the URL to the \f2directory\fP, not to a file.
4270.LP
4271You can use an absolute link for \f2extdocURL\fP to enable your docs to link to a document on any website, or can use a relative link to link only to a relative location. If relative, the value you pass in should be the relative path from the destination directory (specified with \f2\-d\fP) to the directory containing the packages being linked to.
4272.LP
4273When specifying an absolute link you normally use an \f2http:\fP link. However, if you want to link to a file system that has no web server, you can use a \f2file:\fP link \-\- however, do this only if everyone wanting to access the generated documentation shares the same file system.
4274.LP
4275In all cases, and on all operating systems, you should use a forward slash as the separator, whether the URL is absolute or relative, and "http:" or "file:" based (as specified in the
4276.na
4277\f2URL Memo\fP @
4278.fi
4279http://www.ietf.org/rfc/rfc1738.txt).
4280.RS 3
4281.TP 3
4282Absolute http: based link:
4283\f2\-link http://<host>/<directory>/<directory>/.../<name>\fP
4284.TP 3
4285Absolute file: based link:
4286\f2\-link file://<host>/<directory>/<directory>/.../<name>\fP
4287.TP 3
4288Relative link:
4289\f2\-link <directory>/<directory>/.../<name>\fP
4290.RE
4291.RE
4292.LP
4293You can specify multiple \f2\-link\fP options in a given javadoc run to link to multiple documents. \f3Choosing between \-linkoffline and \-link\fP:
4294.br
4295Use \f2\-link\fP:
4296.RS 3
4297.TP 2
4298o
4299when using a relative path to the external API document, or
4300.TP 2
4301o
4302when using an absolute URL to the external API document, if your shell allows a program to open a connection to that URL for reading.
4303.RE
4304Use \f2\-linkoffline\fP:
4305.RS 3
4306.TP 2
4307o
4308when using an absolute URL to the external API document, if your shell \f2does not allow\fP a program to open a connection to that URL for reading. This can occur if you are behind a firewall and the document you want to link to is on the other side.
4309.RE
4310.LP
tbell16c34dd2009-05-04 18:28:26 -07004311\f3Example using absolute links to the external docs\fP \- Let us say you want to link to the \f2java.lang\fP, \f2java.io\fP and other Java Platform packages at
duke6e45e102007-12-01 00:00:00 +00004312.na
tbell16c34dd2009-05-04 18:28:26 -07004313\f2http://java.sun.com/javase/6/docs/api/\fP @
duke6e45e102007-12-01 00:00:00 +00004314.fi
tbell16c34dd2009-05-04 18:28:26 -07004315http://java.sun.com/javase/6/docs/api. The following command generates documentation for the package \f2com.mypackage\fP with links to the Java SE Platform packages. The generated documentation will contain links to the \f2Object\fP class, for example, in the class trees. (Other options, such as \f2\-sourcepath\fP and \f2\-d\fP, are not shown.)
duke6e45e102007-12-01 00:00:00 +00004316.nf
4317\f3
4318.fl
tbell16c34dd2009-05-04 18:28:26 -07004319 % \fP\f3javadoc \-link http://java.sun.com/javase/6/docs/api com.mypackage\fP
duke6e45e102007-12-01 00:00:00 +00004320.fl
4321.fi
tbell16c34dd2009-05-04 18:28:26 -07004322\f3Example using relative links to the external docs\fP \- Let us say you have two packages whose docs are generated in different runs of the Javadoc tool, and those docs are separated by a relative path. In this example, the packages are \f2com.apipackage\fP, an API, and \f2com.spipackage\fP, an SPI (Service Provide Interface). You want the documentation to reside in \f2docs/api/com/apipackage\fP and \f2docs/spi/com/spipackage\fP. Assuming the API package documentation is already generated, and that \f2docs\fP is the current directory, you would document the SPI package with links to the API documentation by running:
duke6e45e102007-12-01 00:00:00 +00004323.nf
4324\f3
4325.fl
4326 % \fP\f3javadoc \-d ./spi \-link ../api com.spipackage\fP
4327.fl
4328.fi
4329.LP
4330Notice the \f2\-link\fP argument is relative to the destination directory (\f2docs/spi\fP).
4331.LP
4332\f3Details\fP \- The \f2\-link\fP option enables you to link to classes referenced to by your code but \f2not\fP documented in the current javadoc run. For these links to go to valid pages, you must know where those HTML pages are located, and specify that location with \f2extdocURL\fP. This allows, for instance, third party documentation to link to \f2java.*\fP documentation on \f2http://java.sun.com\fP.
4333.LP
4334Omit the \f2\-link\fP option for javadoc to create links only to API within the documentation it is generating in the current run. (Without the \f2\-link\fP option, the Javadoc tool does not create links to documentation for external references, because it does not know if or where that documentation exists.)
4335.LP
4336This option can create links in several places in the generated documentation.
4337.LP
4338Another use is for cross\-links between sets of packages: Execute javadoc on one set of packages, then run javadoc again on another set of packages, creating links both ways between both sets.
4339.LP
4340\f3How a Class Must be Referenced\fP \- For a link to an external referenced class to actually appear (and not just its text label), the class must be referenced in the following way. It is not sufficient for it to be referenced in the body of a method. It must be referenced in either an \f2import\fP statement or in a declaration. Here are examples of how the class \f2java.io.File\fP can be referenced:
4341.RS 3
4342.TP 2
4343o
4344In any kind of \f2import\fP statement: by wildcard import, import explicitly by name, or automatically import for \f2java.lang.*\fP. For example, this would suffice:
4345.br
4346\f2import java.io.*;\fP
4347.br
4348In 1.3.x and 1.2.x, only an explicit import by name works \-\- a wildcard import statement does not work, nor does the automatic import \f2java.lang.*\fP.
4349.TP 2
4350o
4351In a declaration:
4352.br
4353\f2void foo(File f) {}\fP
4354.br
4355The reference and be in the return type or parameter type of a method, constructor, field, class or interface, or in an \f2implements\fP, \f2extends\fP or \f2throws\fP statement.
4356.RE
4357.LP
4358An important corollary is that when you use the \f2\-link\fP option, there may be many links that unintentionally do not appear due to this constraint. (The text would appear without a hypertext link.) You can detect these by the warnings they emit. The most innocuous way to properly reference a class and thereby add the link would be to import that class, as shown above.
4359.LP
4360\f3Package List\fP \- The \f2\-link\fP option requires that a file named \f2package\-list\fP, which is generated by the Javadoc tool, exist at the URL you specify with \f2\-link\fP. The \f2package\-list\fP file is a simple text file that lists the names of packages documented at that location. In the earlier example, the Javadoc tool looks for a file named \f2package\-list\fP at the given URL, reads in the package names and then links to those packages at that URL.
4361.LP
tbell16c34dd2009-05-04 18:28:26 -07004362For example, the package list for the Java SE 6 API is located at
duke6e45e102007-12-01 00:00:00 +00004363.na
tbell16c34dd2009-05-04 18:28:26 -07004364\f2http://java.sun.com/javase/6/docs/api/package\-list\fP @
duke6e45e102007-12-01 00:00:00 +00004365.fi
tbell16c34dd2009-05-04 18:28:26 -07004366http://java.sun.com/javase/6/docs/api/package\-list. and starts as follows:
duke6e45e102007-12-01 00:00:00 +00004367.nf
4368\f3
4369.fl
4370 java.applet
4371.fl
4372 java.awt
4373.fl
4374 java.awt.color
4375.fl
4376 java.awt.datatransfer
4377.fl
4378 java.awt.dnd
4379.fl
4380 java.awt.event
4381.fl
4382 java.awt.font
4383.fl
4384 etc.
4385.fl
4386\fP
4387.fi
4388.LP
4389When javadoc is run without the \f2\-link\fP option, when it encounters a name that belongs to an external referenced class, it prints the name with no link. However, when the \f2\-link\fP option is used, the Javadoc tool searches the \f2package\-list\fP file at the specified \f2extdocURL\fP location for that package name. If it finds the package name, it prefixes the name with \f2extdocURL\fP.
4390.LP
4391In order for there to be no broken links, all of the documentation for the external references must exist at the specified URLs. The Javadoc tool will not check that these pages exist \-\- only that the package\-list exists.
4392.LP
4393\f3Multiple Links\fP \- You can supply multiple \f2\-link\fP options to link to any number of external generated documents. \ Javadoc 1.2 has a known bug which prevents you from supplying more than one \f2\-link\fP command. This was fixed in 1.2.2.
4394.LP
4395Specify a different link option for each external document to link to:
4396.LP
4397\ \ \f2% \fP\f4javadoc \-link\fP \f2extdocURL1\fP \f4\-link\fP \f2extdocURL2\fP \f2... \fP\f4\-link\fP \f2extdocURLn\fP \f4com.mypackage\fP
4398.LP
4399where \f2extdocURL1\fP,\ \f2extdocURL2\fP,\ ... \f2extdocURLn\fP point respectively to the roots of external documents, each of which contains a file named \f2package\-list\fP.
4400.LP
4401\f3Cross\-links\fP \- Note that "bootstrapping" may be required when cross\-linking two or more documents that have not previously been generated. In other words, if \f2package\-list\fP does not exist for either document, when you run the Javadoc tool on the first document, the \f2package\-list\fP will not yet exist for the second document. Therefore, to create the external links, you must re\-generate the first document after generating the second document.
4402.LP
4403In this case, the purpose of first generating a document is to create its \f2package\-list\fP (or you can create it by hand it if you're certain of the package names). Then generate the second document with its external links. The Javadoc tool prints a warning if a needed external \f2package\-list\fP file does not exist.
4404.LP
4405.TP 3
4406\-linkoffline\ extdocURL\ packagelistLoc
4407This option is a variation of \f2\-link\fP; they both create links to javadoc\-generated documentation for external referenced classes. Use the \f2\-linkoffline\fP option when linking to a document on the web when the Javadoc tool itself is "offline" \-\- that is, it cannot access the document through a web connection.
4408.LP
4409More specifically, use \f2\-linkoffline\fP if the external document's \f2package\-list\fP file is not accessible or does not exist at the \f2extdocURL\fP location but does exist at a different location, which can be specified by \f2packageListLoc\fP (typically local). Thus, if \f2extdocURL\fP is accessible only on the World Wide Web, \f2\-linkoffline\fP removes the constraint that the Javadoc tool have a web connection when generating the documentation.
4410.LP
4411Another use is as a "hack" to update docs: After you have run javadoc on a full set of packages, then you can run javadoc again on onlya smaller set of changed packages, so that the updated files can be inserted back into the original set. Examples are given below.
4412.LP
4413The \f2\-linkoffline\fP option takes two arguments \-\- the first for the string to be embedded in the \f2<a href>\fP links, the second telling it where to find \f2package\-list\fP:
4414.RS 3
4415.TP 2
4416o
4417\f4extdocURL\fP is the absolute or relative URL of the directory containing the external javadoc\-generated documentation you want to link to. If relative, the value should be the relative path from the destination directory (specified with \f2\-d\fP) to the root of the packages being linked to. For more details, see \f2extdocURL\fP in the \f2\-link\fP option.
4418.TP 2
4419o
4420\f4packagelistLoc\fP is the path or URL to the directory containing the \f2package\-list\fP file for the external documentation. This can be a URL (http: or file:) or file path, and can be absolute or relative. If relative, make it relative to the \f2current\fP directory from where javadoc was run. Do not include the \f2package\-list\fP filename.
4421.RE
4422.LP
4423You can specify multiple \f2\-linkoffline\fP options in a given javadoc run. (Prior to 1.2.2, it could be specified only once.)
4424.LP
tbell16c34dd2009-05-04 18:28:26 -07004425\f3Example using absolute links to the external docs\fP \- Let us say you want to link to the \f2java.lang\fP, \f2java.io\fP and other Java SE Platform packages at \f2http://java.sun.com/javase/6/docs/api\fP, but your shell does not have web access. You could open the \f2package\-list\fP file in a browser at
duke6e45e102007-12-01 00:00:00 +00004426.na
tbell16c34dd2009-05-04 18:28:26 -07004427\f2http://java.sun.com/javase/6/docs/api/package\-list\fP @
duke6e45e102007-12-01 00:00:00 +00004428.fi
tbell16c34dd2009-05-04 18:28:26 -07004429http://java.sun.com/javase/6/docs/api/package\-list, save it to a local directory, and point to this local copy with the second argument, \f2packagelistLoc\fP. In this example, the package list file has been saved to the current directory "\f2.\fP" . The following command generates documentation for the package \f2com.mypackage\fP with links to the Java SE Platform packages. The generated documentation will contain links to the \f2Object\fP class, for example, in the class trees. (Other necessary options, such as \f2\-sourcepath\fP, are not shown.)
duke6e45e102007-12-01 00:00:00 +00004430.nf
4431\f3
4432.fl
tbell16c34dd2009-05-04 18:28:26 -07004433% \fP\f3javadoc \-linkoffline http://java.sun.com/javase/6/docs/api . com.mypackage\fP
duke6e45e102007-12-01 00:00:00 +00004434.fl
4435.fi
4436.LP
4437\f3Example using relative links to the external docs\fP \- It's not very common to use \f2\-linkoffline\fP with relative paths, for the simple reason that \f2\-link\fP usually suffices. When using \f2\-linkoffline\fP, the \f2package\-list\fP file is generally local, and when using relative links, the file you are linking to is also generally local. So it is usually unnecessary to give a different path for the two arguments to \f2\-linkoffline\fP. When the two arguments are identical, you can use \f2\-link\fP. See the \f2\-link\fP relative example.
4438.LP
4439\f3Manually Creating a \fP\f4package\-list\fP\f3 File\fP \- If a \f2package\-list\fP file does not yet exist, but you know what package names your document will link to, you can create your own copy of this file by hand and specify its path with \f2packagelistLoc\fP. An example would be the previous case where the package list for \f2com.spipackage\fP did not exist when \f2com.apipackage\fP was first generated. This technique is useful when you need to generate documentation that links to new external documentation whose package names you know, but which is not yet published. This is also a way of creating \f2package\-list\fP files for packages generated with Javadoc 1.0 or 1.1, where \f2package\-list\fP files were not generated. Likewise, two companies can share their unpublished \f2package\-list\fP files, enabling them to release their cross\-linked documentation simultaneously.
4440.LP
4441\f3Linking to Multiple Documents\fP \- You can include \f2\-linkoffline\fP once for each generated document you want to refer to (each option is shown on a separate line for clarity):
4442.LP
4443\f2% \fP\f4javadoc \-linkoffline\fP \f2extdocURL1\fP \f2packagelistLoc1\fP \f2\\\fP
4444.br
4445\f2\ \ \ \ \ \ \ \ \ \ \fP\f4\-linkoffline\fP \f2extdocURL2\fP \f2packagelistLoc2\fP \f2\\\fP
4446.br
4447\f2\ \ \ \ \ \ \ \ \ \ ...\fP
4448.LP
4449\f3Updating docs\fP \- Another use for \f2\-linkoffline\fP option is useful if your project has dozens or hundreds of packages, if you have already run javadoc on the entire tree, and now, in a separate run, you want to quickly make some small changes and re\-run javadoc on just a small portion of the source tree. This is somewhat of a hack in that it works properly only if your changes are only to doc comments and not to declarations. If you were to add, remove or change any declarations from the source code, then broken links could show up in the index, package tree, inherited member lists, use page, and other places.
4450.LP
tbell16c34dd2009-05-04 18:28:26 -07004451First, you create a new destination directory (call it \f2update\fP) for this new small run. Let us say the original destination directory was named \f2html\fP. In the simplest example, cd to the parent of \f2html\fP. Set the first argument of \f2\-linkoffline\fP to the current directory "." and set the second argument to the relative path to \f2html\fP, where it can find \f2package\-list\fP, and pass in only the package names of the packages you want to update:
duke6e45e102007-12-01 00:00:00 +00004452.nf
4453\f3
4454.fl
4455 % \fP\f3javadoc \-d update \-linkoffline . html com.mypackage\fP
4456.fl
4457.fi
4458When the Javadoc tool is done, copy these generated class pages in \f2update/com/package\fP (not the overview or index), over the original files in \f2html/com/package\fP.
4459.LP
4460.TP 3
4461\-linksource\
4462Creates an HTML version of each source file (with line numbers) and adds links to them from the standard HTML documentation. Links are created for classes, interfaces, constructors, methods and fields whose declarations are in a source file. Otherwise, links are not created, such as for default constructors and generated classes.
4463.LP
4464\f3This option exposes \fP\f4all\fP\f3 private implementation details in the included source files, including private classes, private fields, and the bodies of private methods, \fP\f4regardless of the \fP\f4\-public\fP\f3, \fP\f4\-package\fP\f3, \fP\f4\-protected\fP\f3 and \fP\f4\-private\fP\f3 options.\fP Unless you also use the \f2\-private\fP option, not all private classes or interfaces will necessarily be accessible via links.
4465.LP
4466Each link appears on the name of the identifier in its declaration. For example, the link to the source code of the \f2Button\fP class would be on the word "Button":
4467.nf
4468\f3
4469.fl
4470 public class Button
4471.fl
4472 extends Component
4473.fl
4474 implements Accessible
4475.fl
4476\fP
4477.fi
4478and the link to the source code of the \f2getLabel()\fP method in the Button class would be on the word "getLabel":
4479.nf
4480\f3
4481.fl
4482 public String getLabel()
4483.fl
4484\fP
4485.fi
4486.LP
4487.TP 3
4488\-group\ groupheading\ packagepattern:packagepattern:...
4489Separates packages on the overview page into whatever groups you specify, one group per table. You specify each group with a different \f2\-group\fP option. The groups appear on the page in the order specified on the command line; packages are alphabetized within a group. For a given \f2\-group\fP option, the packages matching the list of \f2packagepattern\fP expressions appear in a table with the heading \f2groupheading\fP.
4490.RS 3
4491.TP 2
4492o
4493\f4groupheading\fP can be any text, and can include white space. This text is placed in the table heading for the group.
4494.TP 2
4495o
4496\f4packagepattern\fP can be any package name, or can be the start of any package name followed by an asterisk (\f2*\fP). The asterisk is a wildcard meaning "match any characters". This is the only wildcard allowed. Multiple patterns can be included in a group by separating them with colons (\f2:\fP).
4497.RE
4498.RS 3
4499
4500.LP
4501.LP
4502\f3NOTE: If using an asterisk in a pattern or pattern list, the pattern list must be inside quotes, such as \fP\f4"java.lang*:java.util"\fP
4503.LP
4504.RE
4505.LP
4506If you do not supply any \f2\-group\fP option, all packages are placed in one group with the heading "Packages". If the all groups do not include all documented packages, any leftover packages appear in a separate group with the heading "Other Packages".
4507.LP
4508For example, the following option separates the four documented packages into core, extension and other packages. Notice the trailing "dot" does not appear in "java.lang*" \-\- including the dot, such as "java.lang.*" would omit the java.lang package.
4509.nf
4510\f3
4511.fl
4512 % \fP\f3javadoc \-group "Core Packages" "java.lang*:java.util"
4513.fl
4514 \-group "Extension Packages" "javax.*"
4515.fl
4516 java.lang java.lang.reflect java.util javax.servlet java.new\fP
4517.fl
4518.fi
4519This results in the groupings:
4520.RS 3
4521.RS 3
4522.TP 3
4523Core Packages
4524\f2java.lang\fP
4525\f2java.lang.reflect\fP
4526\f2java.util\fP
4527.TP 3
4528Extension Packages
4529\f2javax.servlet\fP
4530.TP 3
4531Other Packages
4532\f2java.new\fP
4533.RE
4534
4535.LP
4536.RE
4537.LP
4538.TP 3
4539\-nodeprecated
4540Prevents the generation of any deprecated API at all in the documentation. This does what \-nodeprecatedlist does, plus it does not generate any deprecated API throughout the rest of the documentation. This is useful when writing code and you don't want to be distracted by the deprecated code.
4541.LP
4542.TP 3
4543\-nodeprecatedlist
4544Prevents the generation of the file containing the list of deprecated APIs (deprecated\-list.html) and the link in the navigation bar to that page. (However, javadoc continues to generate the deprecated API throughout the rest of the document.) This is useful if your source code contains no deprecated API, and you want to make the navigation bar cleaner.
4545.LP
4546.TP 3
4547\-nosince
4548Omits from the generated docs the "Since" sections associated with the @since tags.
4549.LP
4550.TP 3
4551\-notree
4552Omits the class/interface hierarchy pages from the generated docs. These are the pages you reach using the "Tree" button in the navigation bar. The hierarchy is produced by default.
4553.LP
4554.TP 3
4555\-noindex
4556Omits the index from the generated docs. The index is produced by default.
4557.LP
4558.TP 3
4559\-nohelp
4560Omits the HELP link in the navigation bars at the top and bottom of each page of output.
4561.LP
4562.TP 3
4563\-nonavbar
4564Prevents the generation of the navigation bar, header and footer, otherwise found at the top and bottom of the generated pages. Has no affect on the "bottom" option. The \f2\-nonavbar\fP option is useful when you are interested only in the content and have no need for navigation, such as converting the files to PostScript or PDF for print only.
4565.LP
4566.TP 3
4567\-helpfile\ path/filename
4568Specifies the path of an alternate help file \f2path/filename\fP that the HELP link in the top and bottom navigation bars link to. Without this option, the Javadoc tool automatically creates a help file \f2help\-doc.html\fP that is hard\-coded in the Javadoc tool. This option enables you to override this default. The \f2filename\fP can be any name and is not restricted to \f2help\-doc.html\fP \-\- the Javadoc tool will adjust the links in the navigation bar accordingly. For example:
4569.nf
4570\f3
4571.fl
4572 % \fP\f3javadoc \-helpfile /home/user/myhelp.html java.awt\fP
4573.fl
4574.fi
4575.TP 3
4576\-stylesheetfile\ path/filename
4577Specifies the path of an alternate HTML stylesheet file. Without this option, the Javadoc tool automatically creates a stylesheet file \f2stylesheet.css\fP that is hard\-coded in the Javadoc tool. This option enables you to override this default. The \f2filename\fP can be any name and is not restricted to \f2stylesheet.css\fP. For example:
4578.nf
4579\f3
4580.fl
4581 % \fP\f3javadoc \-stylesheetfile /home/user/mystylesheet.css com.mypackage\fP
4582.fl
4583.fi
4584.TP 3
4585\-serialwarn
4586Generates compile\-time warnings for missing @serial tags. By default, Javadoc 1.2.2 (and later versions) generates no serial warnings. (This is a reversal from earlier versions.) Use this option to display the serial warnings, which helps to properly document default serializable fields and \f2writeExternal\fP methods.
4587.LP
4588.TP 3
4589\-charset\ name
4590Specifies the HTML character set for this document. The name should be a preferred MIME name as given in the
4591.na
4592\f2IANA Registry\fP @
4593.fi
4594http://www.iana.org/assignments/character\-sets. For example:
4595.nf
4596\f3
4597.fl
4598 % \fP\f3javadoc \-charset "iso\-8859\-1" mypackage\fP
4599.fl
4600.fi
4601would insert the following line in the head of every generated page:
4602.nf
4603\f3
4604.fl
4605 <META http\-equiv="Content\-Type" content="text/html; charset=ISO\-8859\-1">
4606.fl
4607\fP
4608.fi
4609This META tag is described in the
4610.na
4611\f2HTML standard\fP @
4612.fi
4613http://www.w3.org/TR/REC\-html40/charset.html#h\-5.2.2. (4197265 and 4137321)
4614.LP
4615Also see \-encoding and \-docencoding.
4616.LP
4617.TP 3
4618\-docencoding\ name
4619Specifies the encoding of the generated HTML files. The name should be a preferred MIME name as given in the
4620.na
4621\f2IANA Registry\fP @
4622.fi
4623http://www.iana.org/assignments/character\-sets. If you omit this option but use \-encoding, then the encoding of the generated HTML files is determined by \-encoding. Example:
4624.nf
4625\f3
4626.fl
4627 % \fP\f3javadoc \-docencoding "ISO\-8859\-1" mypackage\fP
4628.fl
4629.fi
4630Also see \-encoding and \-charset.
4631.LP
4632.TP 3
4633\-keywords
4634Adds HTML meta keyword tags to the generated file for each class. These tags can help the page be found by search engines that look for meta tags. (Most search engines that search the entire Internet do not look at meta tags, because pages can misuse them; but search engines offered by companies that confine their search to their own website can benefit by looking at meta tags.)
4635.LP
4636The meta tags include the fully qualified name of the class and the unqualified names of the fields and methods. Constructors are not included because they are identical to the class name. For example, the class String starts with these keywords:
4637.nf
4638\f3
4639.fl
4640 <META NAME="keywords" CONTENT="java.lang.String class">
4641.fl
4642 <META NAME="keywords" CONTENT="CASE_INSENSITIVE_ORDER">
4643.fl
4644 <META NAME="keywords" CONTENT="length()">
4645.fl
4646 <META NAME="keywords" CONTENT="charAt()">
4647.fl
4648\fP
4649.fi
4650.LP
4651.TP 3
4652\-tag\ \ tagname:Xaoptcmf:"taghead"
4653Enables the Javadoc tool to interpret a simple, one\-argument custom block tag \f2@\fP\f2tagname\fP in doc comments. So the Javadoc tool can "spell\-check" tag names, it is important to include a \f2\-tag\fP option for every custom tag that is present in the source code, disabling (with \f2X\fP) those that are not being output in the current run.
4654.LP
4655The colon (\f4:\fP) is always the separator. To use a colon in \f2tagname\fP, see Use of Colon in Tag Name.
4656.LP
4657The \f2\-tag\fP option outputs the tag's heading \f2taghead\fP in bold, followed on the next line by the text from its single argument, as shown in the example below. Like any block tag, this argument's text can contain inline tags, which are also interpreted. The output is similar to standard one\-argument tags, such as \f2@return\fP and \f2@author\fP. Omitting \f2taghead\fP causes \f2tagname\fP to appear as the heading.
4658.LP
4659\f3Placement of tags\fP \- The \f4Xaoptcmf\fP part of the argument determines where in the source code the tag is allowed to be placed, and whether the tag can be disabled (using \f2X\fP). You can supply either \f4a\fP, to allow the tag in all places, or any combination of the other letters: \f4X\fP (disable tag)
4660.br
4661\f4a\fP (all)
4662.br
4663\f4o\fP (overview)
4664.br
4665\f4p\fP (packages)
4666.br
4667\f4t\fP (types, that is classes and interfaces)
4668.br
4669\f4c\fP (constructors)
4670.br
4671\f4m\fP (methods)
4672.br
4673\f4f\fP (fields)
4674.LP
tbell16c34dd2009-05-04 18:28:26 -07004675\f3Examples of single tags\fP \- An example of a tag option for a tag that can be used anywhere in the source code is:
duke6e45e102007-12-01 00:00:00 +00004676.nf
4677\f3
4678.fl
4679 \-tag todo:a:"To Do:"
4680.fl
4681\fP
4682.fi
4683If you wanted @todo to be used only with constructors, methods and fields, you would use:
4684.nf
4685\f3
4686.fl
4687 \-tag todo:cmf:"To Do:"
4688.fl
4689\fP
4690.fi
4691Notice the last colon (\f2:\fP) above is not a parameter separator, but is part of the heading text (as shown below). You would use either tag option for source code that contains the tag \f2@todo\fP, such as:
4692.nf
4693\f3
4694.fl
4695 @todo The documentation for this method needs work.
4696.fl
4697\fP
4698.fi
4699\f3Use of Colon in Tag Name\fP \- A colon can be used in a tag name if it is escaped with a backslash. For this doc comment:
4700.nf
4701\f3
4702.fl
4703 /**
4704.fl
4705 * @ejb:bean
4706.fl
4707 */
4708.fl
4709\fP
4710.fi
4711use this tag option:
4712.nf
4713\f3
4714.fl
4715 \-tag ejb\\\\:bean:a:"EJB Bean:"
4716.fl
4717\fP
4718.fi
4719\f3Spell\-checking tag names (Disabling tags)\fP \- Some developers put custom tags in the source code that they don't always want to output. In these cases, it is important to list all tags that are present in the source code, enabling the ones you want to output and disabling the ones you don't want to output. The presence of \f2X\fP disables the tag, while its absence enables the tag. This gives the Javadoc tool enough information to know if a tag it encounters is unknown, probably the results of a typo or a misspelling. It prints a warning in these cases.
4720.LP
4721You can add \f2X\fP to the placement values already present, so that when you want to enable the tag, you can simply delete the \f2X\fP. For example, if @todo is a tag that you want to suppress on output, you would use:
4722.nf
4723\f3
4724.fl
4725 \-tag todo:Xcmf:"To Do:"
4726.fl
4727\fP
4728.fi
4729or, if you'd rather keep it simple:
4730.nf
4731\f3
4732.fl
4733 \-tag todo:X
4734.fl
4735\fP
4736.fi
4737.LP
4738The syntax \f2\-tag todo:X\fP works even if \f2@todo\fP is defined by a taglet.
4739.LP
4740\f3Order of tags\fP \- The order of the \f2\-tag\fP (and \f2\-taglet\fP) options determine the order the tags are output. You can mix the custom tags with the standard tags to intersperse them. The tag options for standard tags are placeholders only for determining the order \-\- they take only the standard tag's name. (Subheadings for standard tags cannot be altered.) This is illustrated in the following example.
4741.LP
4742If \f2\-tag\fP is missing, then the position of \f2\-taglet\fP determines its order. If they are both present, then whichever appears last on the command line determines its order. (This happens because the tags and taglets are processed in the order that they appear on the command line. For example, if \f2\-taglet\fP and \f2\-tag\fP both have the name "todo", the one that appears last on the command line will determine its order.
4743.LP
4744\f3Example of a complete set of tags\fP \- This example inserts "To Do" after "Parameters" and before "Throws" in the output. By using "X", it also specifies that @example is a tag that might be encountered in the source code that should not be output during this run. Notice that if you use @argfile, you can put the tags on separate lines in an argument file like this (no line continuation characters needed):
4745.nf
4746\f3
4747.fl
4748 \-tag param
4749.fl
4750 \-tag return
4751.fl
4752 \-tag todo:a:"To Do:"
4753.fl
4754 \-tag throws
4755.fl
4756 \-tag see
4757.fl
4758 \-tag example:X
4759.fl
4760\fP
4761.fi
4762.LP
4763When javadoc parses the doc comments, any tag encountered that is neither a standard tag nor passed in with \f2\-tag\fP or \f2\-taglet\fP is considered unknown, and a warning is thrown.
4764.LP
4765The standard tags are initially stored internally in a list in their default order. Whenever \f2\-tag\fP options are used, those tags get appended to this list \-\- standard tags are moved from their default position. Therefore, if a \f2\-tag\fP option is omitted for a standard tag, it remains in its default position.
4766.LP
4767\f3Avoiding Conflicts\fP \- If you want to slice out your own namespace, you can use a dot\-separated naming convention similar to that used for packages: \f2com.mycompany.todo\fP. Sun will continue to create standard tags whose names do not contain dots. Any tag you create will override the behavior of a tag by the same name defined by Sun. In other words, if you create a tag or taglet \f2@todo\fP, it will always have the same behavior you define, even if Sun later creates a standard tag of the same name.
4768.LP
4769\f3Annotations vs. Javadoc Tags\fP \- In general, if the markup you want to add is intended to affect or produce documentation, it should probably be a javadoc tag; otherwise, it should be an annotation. See
4770.na
4771\f2Comparing Annotations and Javadoc Tags\fP @
4772.fi
4773http://java.sun.com/j2se/javadoc/writingdoccomments/index.html#annotations
4774.LP
4775You can also create more complex block tags, or custom inline tags with the \-taglet option.
4776.LP
4777.TP 3
4778\-taglet\ \ class
4779Specifies the class file that starts the taglet used in generating the documentation for that tag. Use the fully\-qualified name for \f2class\fP. This taglet also defines the number of text arguments that the custom tag has. The taglet accepts those arguments, processes them, and generates the output. For extensive documentation with example taglets, see:
4780.RS 3
4781.TP 2
4782o
tbell16c34dd2009-05-04 18:28:26 -07004783.na
4784\f2Taglet Overview\fP @
4785.fi
4786http://java.sun.com/javase/6/docs/technotes/guides/javadoc/taglet/overview.html
duke6e45e102007-12-01 00:00:00 +00004787.RE
4788.LP
4789Taglets are useful for block or inline tags. They can have any number of arguments and implement custom behavior, such as making text bold, formatting bullets, writing out the text to a file, or starting other processes.
4790.LP
4791Taglets can only determine where a tag should appear and in what form. All other decisions are made by the doclet. So a taglet cannot do things such as remove a class name from the list of included classes. However, it can execute side effects, such as printing the tag's text to a file or triggering another process.
4792.LP
4793Use the \f2\-tagletpath\fP option to specify the path to the taglet. Here is an example that inserts the "To Do" taglet after "Parameters" and ahead of "Throws" in the generated pages:
4794.nf
4795\f3
4796.fl
4797 \-taglet com.sun.tools.doclets.ToDoTaglet
4798.fl
4799 \-tagletpath /home/taglets
4800.fl
4801 \-tag return
4802.fl
4803 \-tag param
4804.fl
4805 \-tag todo
4806.fl
4807 \-tag throws
4808.fl
4809 \-tag see
4810.fl
4811\fP
4812.fi
4813.LP
4814Alternatively, you can use the \f2\-taglet\fP option in place of its \f2\-tag\fP option, but that may be harder to read.
4815.LP
4816.TP 3
4817\-tagletpath\ \ tagletpathlist
4818Specifies the search paths for finding taglet class files (.class). The \f2tagletpathlist\fP can contain multiple paths by separating them with a colon (\f2:\fP). The Javadoc tool will search in all subdirectories of the specified paths.
4819.LP
4820.TP 3
4821\-docfilessubdirs\
4822Enables deep copying of "\f2doc\-files\fP" directories. In other words, subdirectories and all contents are recursively copied to the destination. For example, the directory \f2doc\-files/example/images\fP and all its contents would now be copied. There is also an option to exclude subdirectories.
4823.LP
4824.TP 3
4825\-excludedocfilessubdir\ \ name1:name2...
4826Excludes any "\f2doc\-files\fP" subdirectories with the given names. This prevents the copying of SCCS and other source\-code\-control subdirectories.
4827.LP
4828.TP 3
4829\-noqualifier\ \ all\ | \ packagename1:packagename2:...
4830Omits qualifying package name from ahead of class names in output. The argument to \f2\-noqualifier\fP is either "\f2all\fP" (all package qualifiers are omitted) or a colon\-separate list of packages, with wildcards, to be removed as qualifiers. The package name is removed from places where class or interface names appear.
4831.LP
4832The following example omits all package qualifiers:
4833.nf
4834\f3
4835.fl
4836 \-noqualifier all
4837.fl
4838\fP
4839.fi
4840The following example omits "java.lang" and "java.io" package qualifiers:
4841.nf
4842\f3
4843.fl
4844 \-noqualifier java.lang:java.io
4845.fl
4846\fP
4847.fi
4848The following example omits package qualifiers starting with "java", and "com.sun" subpackages (but not "javax"):
4849.nf
4850\f3
4851.fl
4852 \-noqualifier java.*:com.sun.*
4853.fl
4854\fP
4855.fi
4856Where a package qualifier would appear due to the above behavior, the name can be suitably shortened \-\- see How a name is displayed. This rule is in effect whether or not \f2\-noqualifier\fP is used.
4857.LP
4858.TP 3
4859\-notimestamp\
4860Suppresses the timestamp, which is hidden in an HTML comment in the generated HTML near the top of each page. Useful when you want to run javadoc on two source bases and diff them, as it prevents timestamps from causing a diff (which would otherwise be a diff on every page). The timestamp includes the javadoc version number, and currently looks like this:
4861.nf
4862\f3
4863.fl
tbell16c34dd2009-05-04 18:28:26 -07004864 <!\-\- Generated by javadoc (build 1.5.0_01) on Thu Apr 02 14:04:52 IST 2009 \-\->
duke6e45e102007-12-01 00:00:00 +00004865.fl
4866\fP
4867.fi
4868.LP
4869.TP 3
4870\-nocomment\
4871Suppress the entire comment body, including the main description and all tags, generating only declarations. This option enables re\-using source files originally intended for a different purpose, to produce skeleton HTML documentation at the early stages of a new project.
4872.RE
4873.SH "COMMAND LINE ARGUMENT FILES"
4874.LP
tbell16c34dd2009-05-04 18:28:26 -07004875
4876.LP
duke6e45e102007-12-01 00:00:00 +00004877.LP
4878To shorten or simplify the javadoc command line, you can specify one or more files that themselves contain arguments to the \f2javadoc\fP command (except \f2\-J\fP options). This enables you to create javadoc commands of any length on any operating system.
4879.LP
4880.LP
4881An argument file can include javac options and source filenames in any combination. The arguments within a file can be space\-separated or newline\-separated. If a filename contains embedded spaces, put the whole filename in double quotes.
4882.LP
4883.LP
4884Filenames within an argument file are relative to the current directory, not the location of the argument file. Wildcards (*) are not allowed in these lists (such as for specifying \f2*.java\fP). Use of the '\f2@\fP' character to recursively interpret files is not supported. The \f2\-J\fP options are not supported because they are passed to the launcher, which does not support argument files.
4885.LP
4886.LP
4887When executing javadoc, pass in the path and name of each argument file with the '\f2@\fP' leading character. When javadoc encounters an argument beginning with the character `\f2@\fP', it expands the contents of that file into the argument list.
4888.LP
4889.SS
4890Example \- Single Arg File
4891.LP
4892.LP
4893You could use a single argument file named "\f2argfile\fP" to hold all Javadoc arguments:
4894.LP
4895.nf
4896\f3
4897.fl
4898 % \fP\f3javadoc @argfile\fP
4899.fl
4900.fi
4901
4902.LP
4903.LP
4904This argument file could contain the contents of both files shown in the next example.
4905.LP
4906.SS
4907Example \- Two Arg Files
4908.LP
4909.LP
4910You can create two argument files \-\- one for the Javadoc options and the other for the package names or source filenames: (Notice the following lists have no line\-continuation characters.)
4911.LP
4912.LP
4913Create a file named "\f2options\fP" containing:
4914.LP
4915.nf
4916\f3
4917.fl
4918 \-d docs\-filelist
4919.fl
4920 \-use
4921.fl
4922 \-splitindex
4923.fl
tbell16c34dd2009-05-04 18:28:26 -07004924 \-windowtitle 'Java(TM) SE 7 API Specification'
duke6e45e102007-12-01 00:00:00 +00004925.fl
tbell16c34dd2009-05-04 18:28:26 -07004926 \-doctitle 'Java(TM) SE 7 API Specification'
duke6e45e102007-12-01 00:00:00 +00004927.fl
tbell16c34dd2009-05-04 18:28:26 -07004928 \-header '<b>Java(TM); SE 7'
duke6e45e102007-12-01 00:00:00 +00004929.fl
tbell16c34dd2009-05-04 18:28:26 -07004930 \-bottom 'Copyright 1993\-2009 Sun Microsystems, Inc. All Rights Reserved.'
duke6e45e102007-12-01 00:00:00 +00004931.fl
4932 \-group "Core Packages" "java.*"
4933.fl
tbell16c34dd2009-05-04 18:28:26 -07004934 \-overview /java/pubs/ws/1.7.0/src/share/classes/overview\-core.html
duke6e45e102007-12-01 00:00:00 +00004935.fl
tbell16c34dd2009-05-04 18:28:26 -07004936 \-sourcepath /java/pubs/ws/1.7.0/src/share/classes
duke6e45e102007-12-01 00:00:00 +00004937.fl
4938\fP
4939.fi
4940
4941.LP
4942.LP
4943Create a file named "\f2packages\fP" containing:
4944.LP
4945.nf
4946\f3
4947.fl
4948 com.mypackage1
4949.fl
4950 com.mypackage2
4951.fl
4952 com.mypackage3
4953.fl
4954\fP
4955.fi
4956
4957.LP
4958.LP
4959You would then run javadoc with:
4960.LP
4961.nf
4962\f3
4963.fl
4964 % \fP\f3javadoc @options @packages\fP
4965.fl
4966.fi
4967
4968.LP
4969.SS
4970Example \- Arg Files with Paths
4971.LP
4972.LP
4973The argument files can have paths, but any filenames inside the files are relative to the current working directory (not \f2path1\fP or \f2path2\fP):
4974.LP
4975.nf
4976\f3
4977.fl
4978 % \fP\f3javadoc @path1/options @path2/packages\fP
4979.fl
4980.fi
4981
4982.LP
4983.SS
4984Example \- Option Arguments
4985.LP
4986.LP
4987Here's an example of saving just an argument to a javadoc option in an argument file. We'll use the \f2\-bottom\fP option, since it can have a lengthy argument. You could create a file named "\f2bottom\fP" containing its text argument:
4988.LP
4989.nf
4990\f3
4991.fl
4992'<font size="\-1"><a href="http://java.sun.com/cgi\-bin/bugreport.cgi">Submit a
4993.fl
4994bug or feature</a><br><br>Java is a trademark or registered trademark of
4995.fl
4996Sun Microsystems, Inc. in the US and other countries.<br>Copyright 1993\-2000 Sun
4997.fl
4998Microsystems, Inc. 901 San Antonio Road,<br>Palo Alto, California, 94303, U.S.A.
4999.fl
5000All Rights Reserved.</font>'
5001.fl
5002\fP
5003.fi
5004
5005.LP
5006.LP
5007Then run the Javadoc tool with:
5008.LP
5009.nf
5010\f3
5011.fl
5012 % \fP\f3javadoc \-bottom @bottom @packages\fP
5013.fl
5014.fi
5015
5016.LP
5017.LP
5018Or you could include the \f2\-bottom\fP option at the start of the argument file, and then just run it as:
5019.LP
5020.nf
5021\f3
5022.fl
5023 % \fP\f3javadoc @bottom @packages\fP
5024.fl
5025.fi
tbell16c34dd2009-05-04 18:28:26 -07005026
5027.LP
5028
5029.LP
5030.SH "Name"
duke6e45e102007-12-01 00:00:00 +00005031Running
tbell16c34dd2009-05-04 18:28:26 -07005032.LP
duke6e45e102007-12-01 00:00:00 +00005033.SH "RUNNING JAVADOC"
5034.LP
tbell16c34dd2009-05-04 18:28:26 -07005035
5036.LP
duke6e45e102007-12-01 00:00:00 +00005037.LP
5038\f3Version Numbers\fP \- The version number of javadoc can be determined using \f3javadoc \-J\-version\fP. The version number of the standard doclet appears in its output stream. It can be turned off with \f2\-quiet\fP.
5039.LP
5040.LP
tbell16c34dd2009-05-04 18:28:26 -07005041\f3Public programmatic interface\fP \- To invoke the Javadoc tool from within programs written in the Java language. This interface is in \f2com.sun.tools.javadoc.Main\fP (and javadoc is re\-entrant). For more details, see
duke6e45e102007-12-01 00:00:00 +00005042.na
tbell16c34dd2009-05-04 18:28:26 -07005043\f2Standard Doclet\fP @
duke6e45e102007-12-01 00:00:00 +00005044.fi
tbell16c34dd2009-05-04 18:28:26 -07005045http://java.sun.com/javase/6/docs/technotes/guides/javadoc/standard\-doclet.html#runningprogrammatically.
5046.LP
5047.LP
5048\f3Running Doclets\fP \- The instructions given below are for invoking the standard HTML doclet. To invoke a custom doclet, use the \-doclet and \-docletpath options. For full, working examples of running a particular doclet, see the
5049.na
5050\f2MIF Doclet documentation\fP @
5051.fi
5052http://java.sun.com/j2se/javadoc/mifdoclet/docs/mifdoclet.html.
duke6e45e102007-12-01 00:00:00 +00005053.LP
5054.SH "SIMPLE EXAMPLES"
5055.LP
tbell16c34dd2009-05-04 18:28:26 -07005056
5057.LP
duke6e45e102007-12-01 00:00:00 +00005058.LP
5059You can run javadoc on entire packages or individual source files. Each package name has a corresponding directory name. In the following examples, the source files are located at \f2/home/src/java/awt/*.java\fP. The destination directory is \f2/home/html\fP.
5060.LP
5061.SS
5062Documenting One or More Packages
5063.LP
5064.LP
5065To document a package, the source files (\f2*.java\fP) for that package must be located in a directory having the same name as the package. If a package name is made up of several identifiers (separated by dots, such as \f2java.awt.color\fP), each subsequent identifier must correspond to a deeper subdirectory (such as \f2java/awt/color\fP). You may split the source files for a single package among two such directory trees located at different places, as long as \f2\-sourcepath\fP points to them both \-\- for example \f2src1/java/awt/color\fP and \f2src2/java/awt/color\fP.
5066.LP
5067.LP
5068You can run javadoc either by changing directories (with \f2cd\fP) or by using \f2\-sourcepath\fP option. The examples below illustrate both alternatives.
5069.LP
5070.RS 3
5071.TP 2
5072o
5073\f3Case 1 \- Run recursively starting from one or more packages\fP \- This example uses \-sourcepath so javadoc can be run from any directory and \-subpackages (a new 1.4 option) for recursion. It traverses the subpackages of the \f2java\fP directory excluding packages rooted at \f2java.net\fP and \f2java.lang\fP. Notice this excludes \f2java.lang.ref\fP, a subpackage of \f2java.lang\fP).
5074.nf
5075\f3
5076.fl
5077 % \fP\f3javadoc \fP\f3\-d\fP\f3 /home/html \fP\f3\-sourcepath\fP\f3 /home/src \fP\f3\-subpackages\fP\f3 java \fP\f3\-exclude\fP\f3 java.net:java.lang\fP
5078.fl
5079.fi
5080.LP
5081To also traverse down other package trees, append their names to the \f2\-subpackages\fP argument, such as \f2java:javax:org.xml.sax\fP.
5082.TP 2
5083o
5084\f3Case 2 \- Run on explicit packages after changing to the "root" source directory\fP \- Change to the parent directory of the fully\-qualified package. Then run javadoc, supplying names of one or more packages you want to document:
5085.nf
5086\f3
5087.fl
5088 % \fP\f3cd /home/src/\fP
5089.fl
5090 % \f3javadoc \-d /home/html java.awt java.awt.event\fP
5091.fl
5092.fi
5093.TP 2
5094o
5095\f3Case 3 \- Run from any directory on explicit packages in a single directory tree\fP \- In this case, it doesn't matter what the current directory is. Run javadoc supplying \f2\-sourcepath\fP with the parent directory of the top\-level package, and supplying names of one or more packages you want to document:
5096.nf
5097\f3
5098.fl
5099 % \fP\f3javadoc \-d /home/html \-sourcepath /home/src java.awt java.awt.event\fP
5100.fl
5101.fi
5102.TP 2
5103o
5104\f3Case 4 \- Run from any directory on explicit packages in multiple directory trees\fP \- This is the same as case 3, but for packages in separate directory trees. Run javadoc supplying \f2\-sourcepath\fP with the path to each tree's root (colon\-separated) and supply names of one or more packages you want to document. All source files for a given package do not need to be located under a single root directory \-\- they just need to be found somewhere along the sourcepath.
5105.nf
5106\f3
5107.fl
5108 % \fP\f3javadoc \-d /home/html \-sourcepath /home/src1:/home/src2 java.awt java.awt.event\fP
5109.fl
5110.fi
5111.RE
5112
5113.LP
5114.LP
5115Result: All cases generate HTML\-formatted documentation for the public and protected classes and interfaces in packages \f2java.awt\fP and \f2java.awt.event\fP and save the HTML files in the specified destination directory (\f2/home/html\fP). Because two or more packages are being generated, the document has three HTML frames \-\- for the list of packages, the list of classes, and the main class pages.
5116.LP
5117.SS
5118Documenting One or More Classes
5119.LP
5120.LP
5121The second way to run the Javadoc tool is by passing in one or more source files (\f2.java\fP). You can run javadoc either of the following two ways \-\- by changing directories (with \f2cd\fP) or by fully\-specifying the path to the \f2.java\fP files. Relative paths are relative to the current directory. The \f2\-sourcepath\fP option is ignored when passing in source files. You can use command line wildcards, such as asterisk (*), to specify groups of classes.
5122.LP
5123.RS 3
5124.TP 2
5125o
5126\f3Case 1 \- Changing to the source directory\fP \- Change to the directory holding the \f2.java\fP files. Then run javadoc, supplying names of one or more source files you want to document.
5127.nf
5128\f3
5129.fl
5130 % \fP\f3cd /home/src/java/awt\fP
5131.fl
5132 % \f3javadoc \-d /home/html Button.java Canvas.java Graphics*.java\fP
5133.fl
5134.fi
5135This example generates HTML\-formatted documentation for the classes \f2Button\fP, \f2Canvas\fP and classes beginning with \f2Graphics\fP. Because source files rather than package names were passed in as arguments to javadoc, the document has two frames \-\- for the list of classes and the main page.
5136.TP 2
5137o
5138\f3Case 2 \- Changing to the package root directory\fP \- This is useful for documenting individual source files from different subpackages off the same root. Change to the package root directory, and supply the source files with paths from the root.
5139.nf
5140\f3
5141.fl
5142 % \fP\f3cd /home/src/\fP
5143.fl
5144 % \f3javadoc \-d /home/html java/awt/Button.java java/applet/Applet.java\fP
5145.fl
5146.fi
5147This example generates HTML\-formatted documentation for the classes \f2Button\fP and \f2Applet\fP.
5148.TP 2
5149o
5150\f3Case 3 \- From any directory\fP \- In this case, it doesn't matter what the current directory is. Run javadoc supplying the absolute path (or path relative to the current directory) to the \f2.java\fP files you want to document.
5151.nf
5152\f3
5153.fl
5154 % \fP\f3javadoc \-d /home/html /home/src/java/awt/Button.java /home/src/java/awt/Graphics*.java\fP
5155.fl
5156.fi
5157This example generates HTML\-formatted documentation for the class \f2Button\fP and classes beginning with \f2Graphics\fP.
5158.RE
5159
5160.LP
5161.SS
5162Documenting Both Packages and Classes
5163.LP
5164.LP
5165You can document entire packages and individual classes at the same time. Here's an example that mixes two of the previous examples. You can use \f2\-sourcepath\fP for the path to the packages but not for the path to the individual classes.
5166.LP
5167.nf
5168\f3
5169.fl
5170 % \fP\f3javadoc \-d /home/html \-sourcepath /home/src java.awt /home/src/java/applet/Applet.java\fP
5171.fl
5172.fi
5173
5174.LP
5175.LP
5176This example generates HTML\-formatted documentation for the package \f2java.awt\fP and class \f2Applet\fP. (The Javadoc tool determines the package name for \f2Applet\fP from the package declaration, if any, in the \f2Applet.java\fP source file.)
5177.LP
5178.SH "REAL WORLD EXAMPLE"
5179.LP
tbell16c34dd2009-05-04 18:28:26 -07005180
duke6e45e102007-12-01 00:00:00 +00005181.LP
tbell16c34dd2009-05-04 18:28:26 -07005182.LP
5183The Javadoc tool has many useful options, some of which are more commonly used than others. Here is effectively the command we use to run the Javadoc tool on the Java platform API. We use 180MB of memory to generate the documentation for the 1500 (approx.) public and protected classes in the Java SE Platform, Standard Edition, v1.2.
duke6e45e102007-12-01 00:00:00 +00005184.LP
5185.LP
5186The same example is shown twice \-\- first as executed on the command line, then as executed from a makefile. It uses absolute paths in the option arguments, which enables the same \f2javadoc\fP command to be run from any directory.
5187.LP
5188.SS
5189Command Line Example
5190.LP
5191.LP
5192This command line example is over 900 characters, which is too long for some shells, such as DOS. You can use a command line argument file (or write a shell script) to workaround this limitation.
5193.LP
5194.nf
5195\f3
5196.fl
tbell16c34dd2009-05-04 18:28:26 -07005197% javadoc \-sourcepath /java/jdk/src/share/classes \\
duke6e45e102007-12-01 00:00:00 +00005198.fl
tbell16c34dd2009-05-04 18:28:26 -07005199 \-overview /java/jdk/src/share/classes/overview.html \\
duke6e45e102007-12-01 00:00:00 +00005200.fl
tbell16c34dd2009-05-04 18:28:26 -07005201 \-d /java/jdk/build/api \\
duke6e45e102007-12-01 00:00:00 +00005202.fl
tbell16c34dd2009-05-04 18:28:26 -07005203 \-use \\
duke6e45e102007-12-01 00:00:00 +00005204.fl
tbell16c34dd2009-05-04 18:28:26 -07005205 \-splitIndex \\
duke6e45e102007-12-01 00:00:00 +00005206.fl
tbell16c34dd2009-05-04 18:28:26 -07005207 \-windowtitle 'Java(TM) Platform, Standard Edition 7 API Specification' \\
duke6e45e102007-12-01 00:00:00 +00005208.fl
tbell16c34dd2009-05-04 18:28:26 -07005209 \-doctitle 'Java(TM) Platform, Standard Edition 7 API Specification' \\
duke6e45e102007-12-01 00:00:00 +00005210.fl
tbell16c34dd2009-05-04 18:28:26 -07005211 \-header '<b>Java(TM) SE </b><br><font size="\-1">7</font>' \\
duke6e45e102007-12-01 00:00:00 +00005212.fl
5213 \-bottom '<font size="\-1"><a href="http://java.sun.com/cgi\-bin/bugreport.cgi">Submit
5214.fl
5215a bug or feature</a><br><br>Java is a trademark or registered trademark of Sun Microsystems,
5216.fl
5217Inc. in the US and other countries.<br>Copyright 1993\-1999 Sun Microsystems, Inc.
5218.fl
5219901 San Antonio Road,<br>Palo Alto, California, 94303, U.S.A. All Rights Reserved.</font>' \\
5220.fl
tbell16c34dd2009-05-04 18:28:26 -07005221 \-group "Core Packages" "java.*:com.sun.java.*:org.omg.*" \\
duke6e45e102007-12-01 00:00:00 +00005222.fl
tbell16c34dd2009-05-04 18:28:26 -07005223 \-group "Extension Packages" "javax.*" \\
duke6e45e102007-12-01 00:00:00 +00005224.fl
5225 \-J\-Xmx180m \\
5226.fl
5227 @packages
5228.fl
5229\fP
5230.fi
5231
5232.LP
5233.LP
5234where \f2packages\fP is the name of a file containing the packages to process, such as \f2java.applet java.lang\fP. None of the options should contain any newline characters between the single quotes. (For example, if you copy and paste this example, delete the newline characters from the \f2\-bottom\fP option.) See the other notes listed below.
5235.LP
5236.SS
5237Makefile Example
5238.LP
5239.LP
5240This is an example of a GNU makefile. For an example of a Windows makefile, see
5241.na
5242\f2creating a makefile for Windows\fP @
5243.fi
5244http://java.sun.com/j2se/javadoc/faq/index.html#makefiles.
5245.LP
5246.nf
5247\f3
5248.fl
5249javadoc \-\fP\f3sourcepath\fP\f3 $(SRCDIR) \\ /* Sets path for source files */
5250.fl
5251 \-\fP\f3overview\fP\f3 $(SRCDIR)/overview.html \\ /* Sets file for overview text */
5252.fl
5253 \-\fP\f3d\fP\f3 /java/jdk/build/api \\ /* Sets destination directory */
5254.fl
5255 \-\fP\f3use\fP\f3 \\ /* Adds "Use" files */
5256.fl
5257 \-\fP\f3splitIndex\fP\f3 \\ /* Splits index A\-Z */
5258.fl
5259 \-\fP\f3windowtitle\fP\f3 $(WINDOWTITLE) \\ /* Adds a window title */
5260.fl
5261 \-\fP\f3doctitle\fP\f3 $(DOCTITLE) \\ /* Adds a doc title */
5262.fl
5263 \-\fP\f3header\fP\f3 $(HEADER) \\ /* Adds running header text */
5264.fl
5265 \-\fP\f3bottom\fP\f3 $(BOTTOM) \\ /* Adds text at bottom */
5266.fl
5267 \-\fP\f3group\fP\f3 $(GROUPCORE) \\ /* 1st subhead on overview page */
5268.fl
5269 \-\fP\f3group\fP\f3 $(GROUPEXT) \\ /* 2nd subhead on overview page */
5270.fl
5271 \-\fP\f3J\fP\f3\-Xmx180m \\ /* Sets memory to 180MB */
5272.fl
5273 java.lang java.lang.reflect \\ /* Sets packages to document */
5274.fl
tbell16c34dd2009-05-04 18:28:26 -07005275 java.util java.io java.net \\
duke6e45e102007-12-01 00:00:00 +00005276.fl
5277 java.applet
5278.fl
5279
5280.fl
tbell16c34dd2009-05-04 18:28:26 -07005281WINDOWTITLE = 'Java(TM) SE 7 API Specification'
duke6e45e102007-12-01 00:00:00 +00005282.fl
tbell16c34dd2009-05-04 18:28:26 -07005283DOCTITLE = 'Java(TM) Platform Standard Edition 7 API Specification'
duke6e45e102007-12-01 00:00:00 +00005284.fl
tbell16c34dd2009-05-04 18:28:26 -07005285HEADER = '<b>Java(TM) SE 7</font>'
duke6e45e102007-12-01 00:00:00 +00005286.fl
5287BOTTOM = '<font size="\-1"><a href="http://java.sun.com/cgi\-bin/bugreport.cgi">Submit
5288.fl
5289 a bug or feature</a><br><br>Java is a trademark or registered trademark
5290.fl
5291 of Sun Microsystems, Inc. in the US and other countries.<br>Copyright 1993\-1999
5292.fl
5293 Sun Microsystems, Inc. 901 San Antonio Road,<br>Palo Alto, California, 94303, U.S.A.
5294.fl
5295 All Rights Reserved.</font>'
5296.fl
5297GROUPCORE = '"Core Packages" "java.*:com.sun.java.*:org.omg.*"'
5298.fl
5299GROUPEXT = '"Extension Packages" "javax.*"'
5300.fl
tbell16c34dd2009-05-04 18:28:26 -07005301SRCDIR = '/java/jdk/1.7.0/src/share/classes'
duke6e45e102007-12-01 00:00:00 +00005302.fl
5303\fP
5304.fi
5305
5306.LP
5307.LP
5308Single quotes are used to surround makefile arguments.
5309.LP
5310.LP
5311\f3NOTES\fP
5312.LP
5313.RS 3
5314.TP 2
5315o
5316If you omit the \f2\-windowtitle\fP option, the Javadoc tool copies the doc title to the window title. The \f2\-windowtitle\fP text is basically the same as the \f2\-doctitle\fP but without HTML tags, to prevent those tags from appearing as raw text in the window title.
5317.TP 2
5318o
5319If you omit the \f2\-footer\fP option, as done here, the Javadoc tool copies the header text to the footer.
5320.TP 2
5321o
5322Other important options you might want to use but not needed in this example are \-\f2classpath\fP and \-\f2link\fP.
5323.RE
5324
5325.LP
5326.SH "TROUBLESHOOTING"
5327.LP
tbell16c34dd2009-05-04 18:28:26 -07005328
5329.LP
duke6e45e102007-12-01 00:00:00 +00005330.SS
5331General Troubleshooting
5332.LP
5333.RS 3
5334.TP 2
5335o
5336\f3Javadoc FAQ\fP \- Commonly\-encountered bugs and troubleshooting tips can be found on the
5337.na
5338\f2Javadoc FAQ\fP @
5339.fi
5340http://java.sun.com/j2se/javadoc/faq/index.html#B
5341.TP 2
5342o
tbell16c34dd2009-05-04 18:28:26 -07005343\f3Bugs and Limitations\fP \- You can also see some bugs listed at Important Bug Fixes and Changes.
duke6e45e102007-12-01 00:00:00 +00005344.TP 2
5345o
5346\f3Version number\fP \- See version numbers.
5347.TP 2
5348o
5349\f3Documents only legal classes\fP \- When documenting a package, javadoc only reads files whose names are composed of legal class names. You can prevent javadoc from parsing a file by including, for example, a hyphen "\-" in its filename.
5350.RE
5351
5352.LP
5353.SS
5354Errors and Warnings
5355.LP
5356.LP
5357Error and warning messages contain the filename and line number to the declaration line rather than to the particular line in the doc comment.
5358.LP
5359.RS 3
5360.TP 2
5361o
5362\f2"error: cannot read: Class1.java"\fP the Javadoc tool is trying to load the class Class1.java in the current directory. The class name is shown with its path (absolute or relative), which in this case is the same as \f2./Class1.java\fP.
5363.RE
5364
5365.LP
5366.SH "ENVIRONMENT"
5367.LP
tbell16c34dd2009-05-04 18:28:26 -07005368
5369.LP
duke6e45e102007-12-01 00:00:00 +00005370.RS 3
5371.TP 3
5372CLASSPATH
5373Environment variable that provides the path which javadoc uses to find user class files. This environment variable is overridden by the \f2\-classpath\fP option. Separate directories with a colon, for example:
5374.:/home/classes:/usr/local/java/classes
5375.RE
5376
5377.LP
5378.SH "SEE ALSO"
5379.LP
tbell16c34dd2009-05-04 18:28:26 -07005380
5381.LP
duke6e45e102007-12-01 00:00:00 +00005382.RS 3
5383.TP 2
5384o
tbell16c34dd2009-05-04 18:28:26 -07005385javac(1)
duke6e45e102007-12-01 00:00:00 +00005386.TP 2
5387o
tbell16c34dd2009-05-04 18:28:26 -07005388java(1)
duke6e45e102007-12-01 00:00:00 +00005389.TP 2
5390o
tbell16c34dd2009-05-04 18:28:26 -07005391jdb(1)
duke6e45e102007-12-01 00:00:00 +00005392.TP 2
5393o
tbell16c34dd2009-05-04 18:28:26 -07005394javah(1)
duke6e45e102007-12-01 00:00:00 +00005395.TP 2
5396o
tbell16c34dd2009-05-04 18:28:26 -07005397javap(1)
duke6e45e102007-12-01 00:00:00 +00005398.TP 2
5399o
5400.na
5401\f2Javadoc Home Page\fP @
5402.fi
5403http://java.sun.com/j2se/javadoc/index.jsp
5404.TP 2
5405o
5406.na
5407\f2How to Write Doc Comments for Javadoc\fP @
5408.fi
5409http://java.sun.com/j2se/javadoc/writingdoccomments/index.html
5410.TP 2
5411o
tbell16c34dd2009-05-04 18:28:26 -07005412.na
5413\f2Setting the Class Path\fP @
5414.fi
5415http://java.sun.com/javase/6/docs/technotes/tools/index.html#general
duke6e45e102007-12-01 00:00:00 +00005416.TP 2
5417o
tbell16c34dd2009-05-04 18:28:26 -07005418.na
5419\f2How Javac and Javadoc Find Classes\fP @
5420.fi
5421http://java.sun.com/javase/6/docs/technotes/tools/findingclasses.html#srcfiles (tools.jar)
duke6e45e102007-12-01 00:00:00 +00005422.RE
5423
5424.LP
tbell16c34dd2009-05-04 18:28:26 -07005425
duke6e45e102007-12-01 00:00:00 +00005426.LP
tbell16c34dd2009-05-04 18:28:26 -07005427.LP
5428Javadoc is a trademark of Sun Microsystems, Inc. (The \f2javadoc\fP command itself does not require the trademark symbol.)
5429.LP
5430