Copyright (c) 1994, 2015, Oracle and/or its affiliates. All rights reserved.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
This code is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License version 2 only, as
published by the Free Software Foundation.
This code is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
version 2 for more details (a copy is included in the LICENSE file that
accompanied this code).
You should have received a copy of the GNU General Public License version
2 along with this work; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
or visit www.oracle.com if you need additional information or have any
questions.
Arch: generic
Software: JDK 8
Date: 03 March 2015
SectDesc: Basic Tools
Title: javadoc.1
* Define some portability stuff
-----------------------------------------------------------------
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
http://bugs.debian.org/507673
http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-----------------------------------------------------------------
* set default formatting
-----------------------------------------------------------------
disable hyphenation
disable justification (adjust text to left margin only)
-----------------------------------------------------------------
* MAIN CONTENT STARTS HERE *
-----------------------------------------------------------------
javadoc {packages|source-files} [options] [@argfiles]
packages Names of packages that you want to document, separated by spaces, for example \f3java.lang java.lang.reflect java.awt. If you want to also document the subpackages, use the \f3-subpackages option to specify the packages. By default, \f3javadoc looks for the specified packages in the current directory and subdirectories. Use the \f3-sourcepath option to specify the list of directories where to look for packages.
source-files Names of Java source files that you want to document, separated by spaces, for example \f3Class.java Object.java Button.java. By default, \f3javadoc looks for the specified classes in the current directory. However, you can specify the full path to the class file and use wildcard characters, for example \f3/home/src/java/awt/Graphics*.java. You can also specify the path relative to the current directory.
options Command-line options, separated by spaces. See Options.
@argfiles Names of files that contain a list of \f3javadoc command options, package names and source file names in any order.
You can run the \f3javadoc command on entire packages, individual source files, or both. When documenting entire packages, you can either use the \f3-subpackages option to recursively traverse a directory and its subdirectories, or to pass in an explicit list of package names. When you document individual source files, pass in a list of Java source file names. See Simple Examples.
0.2i The file name prefix (with \f3.java removed) is a valid class name.
0.2i The path name relative to the root of the source tree is a valid package name after the separators are converted to dots.
0.2i The package statement contains the valid package name.
Processing Links During a run, the \f3javadoc command adds cross-reference links to package, class, and member names that are being documented as part of that run. Links appear in the following places. See Javadoc Tags for a description of the @ tags.
0.2i Declarations (return types, argument types, and field types).
0.2i See Also sections that are generated from \f3@see tags.
0.2i Inline text generated from \f3{@link} tags.
0.2i Exception names generated from \f3@throws tags.
0.2i Specified by links to interface members and Overrides links to class members. See Method Comment Inheritance.
0.2i Summary tables listing packages, classes and members.
0.2i Package and class inheritance trees.
0.2i The index.
You can add links to existing text for classes not included on the command line (but generated separately) by way of the \f3-link and \f3-linkoffline options.
Processing Details The \f3javadoc command produces one complete document every time it runs. It does not do incremental builds that modify or directly incorporate the results from earlier runs. However, the \f3javadoc command can link to results from other runs.
The \f3javadoc command implementation requires and relies on the Java compiler. The \f3javadoc command calls part of the \f3javac command to compile the declarations and ignore the member implementations. The \f3javadoc command builds a rich internal representation of the classes that includes the class hierarchy and use relationships to generate the HTML. The \f3javadoc command also picks up user-supplied documentation from documentation comments in the source code. See Documentation Comments.
The \f3javadoc command runs on source files that are pure stub files with no method bodies. This means you can write documentation comments and run the \f3javadoc command in the early stages of design before API implementation.
Relying 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 \f3javadoc command documents default constructors that are present in the compiled class files but not in the source code.
In many cases, the \f3javadoc command lets you generate documentation for source files with incomplete or erroneous code. You can generate documentation before all debugging and troubleshooting is done. The \f3javadoc command does primitive checking of documentation comments.
When the \f3javadoc command builds its internal structure for the documentation, it loads all referenced classes. Because of this, the \f3javadoc command must be able to find all referenced classes, whether bootstrap classes, extensions, or user classes. See How Classes Are Found at http://docs.oracle.com/javase/8/docs/technotes/tools/findingclasses.html
Typically, classes you create must either be loaded as an extension or in the \f3javadoc command class path.
When a custom doclet is not specified with the \f3-doclet option, the \f3javadoc command uses the default standard doclet. The \f3javadoc command has several options that are available regardless of which doclet is being used. The standard doclet adds a supplementary set of command-line options. See Options.
To create a package comment file, you can place your comments in one of the following files:
0.2i The \f3package-info.java file can contain the package declaration, package annotations, package comments, and Javadoc tags. This file is preferred.
0.2i The \f3package.html file contains only package comments and Javadoc tags. No package annotations.
A package can have a single \f3package.html file or a single \f3package-info.java file, but not both. Place either file in the package directory in the source tree with your source files.
The package-info.java File The \f3package-info.java file can contain a package comment of the following structure. The comment is placed before the package declaration.
Note: The comment separators \f3/** and \f3*/ must be present, but the leading asterisks on the intermediate lines can be left off.
\f3/**
\f3 * Provides the classes necessary to create an
\f3 * applet and the classes an applet uses
\f3 * to communicate with its applet context.
\f3 * <p>
\f3 * The applet framework involves two entities:
\f3 * the applet and the applet context.
\f3 * An applet is an embeddable window (see the
\f3 * {@link java.awt.Panel} class) with a few extra
\f3 * methods that the applet context can use to
\f3 * initialize, start, and stop the applet.
\f3 *
\f3 * @since 1.0
\f3 * @see java.awt
\f3 */
\f3package java.lang.applet;
\f3
The package.html File The \f3package.html file can contain a package comment of the following structure. The comment is placed in the \f3<body> element.
File: \f3java/applet/package.html
\f3<HTML>
\f3<BODY>
\f3Provides the classes necessary to create an applet and the
\f3classes an applet uses to communicate with its applet context.
\f3<p>
\f3The applet framework involves two entities: the applet
\f3and the applet context. An applet is an embeddable
\f3window (see the {@link java.awt.Panel} class) with a
\f3few extra methods that the applet context can use to
\f3initialize, start, and stop the applet.
\f3
\f3@since 1.0
\f3@see java.awt
\f3</BODY>
\f3</HTML>
\f3The \f3package.html file is a typical HTML file and does not include a package declaration. The content of the package comment file is written in HTML with one exception. The documentation comment should not include the comment separators \f3/** and \f3*/ or leading asterisks. When writing the comment, make the first sentence a summary about the package, and do not put a title or any other text between the \f3<body> tag and the first sentence. You can include package tags. All block tags must appear after the main description. If you add an \f3@see tag in a package comment file, then it must have a fully qualified name.
Processing the Comment File When the \f3javadoc command runs, it searches for the package comment file. If the package comment file is found, then the \f3javadoc command does the following:
0.2i Copies the comment for processing. For package.html, the \f3javadoc command copies all content between the \f3<body> and \f3</body> HTML tags. You can include a \f3<head> section to put a \f3<title> tag, source file copyright statement, or other information, but none of these appear in the generated documentation.
0.2i Processes the package tags. See Package Tags.
0.2i Inserts the processed text at the bottom of the generated package summary page. See Java Platform, Standard Edition API Specification Overview at http://docs.oracle.com/javase/8/docs/api/overview-summary.html
0.2i Copies the first sentence of the package comment to the top of the package summary page. The \f3javadoc command also adds the package name and this first sentence to the list of packages on the overview page. See Java Platform, Standard Edition API Specification Overview at http://docs.oracle.com/javase/8/docs/api/overview-summary.html The end of the sentence is determined by the same rules used for the end of the first sentence of class and member main descriptions.
You can name the file anything you want such as overview.html and place it anywhere. A typical location is at the top of the source tree.
For example, if the source files for the \f3java.applet package are contained in the /home/user/src/java/applet directory, then you could create an overview comment file at /home/user/src/overview.html.
You can have multiple overview comment files for the same set of source files in case you want to run the \f3javadoc command multiple times on different sets of packages. For example, you could run the \f3javadoc command once with \f3-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.
The content of the overview comment file is one big documentation comment that is written in HTML. Make the first sentence a summary about the application or set of packages. Do not put a title or any other text between the \f3<body> tag and the first sentence. All tags except inline tags, such as an {\f3@link} tag, must appear after the main description. If you add an \f3@see tag, then it must have a fully qualified name.
When you run the \f3javadoc command, specify the overview comment file name with the \f3-overview option. The file is then processed similarly to that of a package comment file. The \f3javadoc command does the following:
0.2i Copies all content between the \f3<body> and \f3</body> tags for processing.
0.2i Processes the overview tags that are present. See Overview Tags.
0.2i Inserts the processed text at the bottom of the generated overview page. See Java Platform Standard Edition API Specification Overview at http://docs.oracle.com/javase/8/docs/api/overview-summary.html
0.2i Copies the first sentence of the overview comment to the top of the overview summary page.
To include unprocessed files, put them in a directory called doc-files. The doc-files directory can be a subdirectory of any package directory that contains source files. You can have one doc-files subdirectory for each package.
For example, if you want to include the image of a button in the \f3java.awt.Button class documentation, then place the image file in the /home/user/src/java/awt/doc-files/ directory. Do not place the doc-files directory at /home/user/src/java/doc-files, because java is not a package. It does not contain any source files.
All links to the unprocessed files must be included in the code because the \f3javadoc command does not look at the files. The \f3javadoc command copies the directory and all of its contents to the destination. The following example shows how the link in the Button.java documentation comment might look:
\f3/**
\f3 * This button looks like this:
\f3 * <img src="doc-files/Button.gif">
\f3 */
\f3
Test files are valid, compilable source files. Template files are not valid, compatible source files, but they often have the \f3.java suffix.
Test Files If you want your test files to belong to either an unnamed package or to a package other than the package that the source files are in, then put the test files in a subdirectory underneath the source files and give the directory an invalid name. If you put the test files in the same directory with the source and call the \f3javadoc command with a command-line argument that indicates its package name, then the test files cause warnings or errors. If the files are in a subdirectory with an invalid name, then the test file directory is skipped and no errors or warnings are issued. For example, to add test files for source files in com.package1, put them in a subdirectory in an invalid package name. The following directory name is invalid because it contains a hyphen:
\f3com/package1/test-files/
\f3If your test files contain documentation comments, then you can set up a separate run of the \f3javadoc command to produce test file documentation by passing in their test source file names with wild cards, such as \f3com/package1/test-files/*.java.
Template Files If you want a template file to be in the source directory, but not generate errors when you execute the \f3javadoc command, then give it an invalid file name such as \f3Buffer-Template.java to prevent it from being processed. The \f3javadoc command only processes source files with names, when stripped of the \f3.java suffix, that are valid class names.
0.2i One class or interface page (classname.html) for each class or interface being documented.
0.2i One package page (package-summary.html) for each package being documented. The \f3javadoc command includes any HTML text provided in a file with the name package.html or package-info.java in the package directory of the source tree.
0.2i One overview page (overview-summary.html) for the entire set of packages. The overview page is the front page of the generated document. The \f3javadoc command includes any HTML text provided in a file specified by the \f3-overview option. The Overview page is created only when you pass two or more package names into the \f3javadoc command. See HTML Frames and Options.
0.2i One class hierarchy page for the entire set of packages (overview-tree.html). To view the hierarchy page, click Overview in the navigation bar and click Tree.
0.2i One class hierarchy page for each package (package-tree.html) To view the hierarchy page, go to a particular package, class, or interface page, and click Tree to display the hierarchy for that package.
0.2i One use page for each package (package-use.html) and a separate use page for each class and interface (class-use/classname.html). The use page describes what packages, classes, methods, constructors and fields use any part of the specified class, interface, or package. For example, 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. To view the use page, go to the package, class, or interface and click the Use link in the navigation bar.
0.2i A deprecated API page (deprecated-list.html) that lists all deprecated APIs and their suggested replacements. Avoid deprecated APIs because they can be removed in future implementations.
0.2i A constant field values page (constant-values.html) for the values of static fields.
0.2i A serialized form page (serialized-form.html) that provides information about serializable and externalizable classes with field and method descriptions. The information on this page is of interest to reimplementors, and not to developers who want to use the API. To access the serialized form page, go to any serialized class and click Serialized Form in the See Also section of the class comment. The standard doclet generates a serialized form page that lists any class (public or non-public) that implements Serializable with its \f3readObject and \f3writeObject methods, the fields that are serialized, and the documentation comments from the \f3@serial, \f3@serialField, and \f3@serialData tags. Public serializable classes can be excluded by marking them (or their package) with \f3@serial exclude, and package-private serializable classes can be included by marking them (or their package) with an \f3@serial include. As of Release 1.4, you can generate the complete serialized form for public and private classes by running the \f3javadoc command without specifying the \f3-private option. See Options.
0.2i An index page (\f3index-*.html) of all class, interface, constructor, field and method names, in alphabetical order. The index page is internationalized for Unicode and can be generated as a single file or as a separate file for each starting character (such as A\(enZ for English).
0.2i A help page (help-doc.html) that describes the navigation bar and the previous pages. Use \f3-helpfile to override the default help file with your own custom help file.
0.2i One index.html file that creates the HTML frames for display. Load this file to display the front page with frames. The index.html file contains no text content.
0.2i Several frame files (\f3*-frame.html) that contains lists of packages, classes, and interfaces. The frame files display the HTML frames.
0.2i A package list file (package-list) that is used by the \f3-link and \f3-linkoffline options. The package list file is a text file that is not reachable through links.
0.2i A style sheet file (stylesheet.css) that controls a limited amount of color, font family, font size, font style, and positioning information on the generated pages.
0.2i A doc-files directory that holds image, example, source code, or other files that you want copied to the destination directory. These files are not processed by the \f3javadoc command. This directory is not processed unless it exists in the source tree.
See Options.
For example, the document generated for the \f3java.applet.Applet class would be located at java/applet/Applet.html.
The file structure for the \f3java.applet package follows, assuming that the destination directory is named \f3apidocs. 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.
Directories are bold. The asterisks (*) indicate the files and directories that are omitted when the arguments to the \f3javadoc command are source file names rather than package names. When arguments are source file names, an empty package list is created. The doc-files directory is not created in the destination unless it exists in the source tree. See Generated Files.
0.2i apidocs: Top-level directory
0.2i index.html: Initial Page that sets up HTML frames
0.2i *overview-summary.html: Package list with summaries
0.2i overview-tree.html: Class hierarchy for all packages
0.2i deprecated-list.html: Deprecated APIs for all packages
0.2i constant-values.html: Static field values for all packages
0.2i serialized-form.html: Serialized forms for all packages
0.2i *overview-frame.html: All packages for display in upper-left frame
0.2i allclasses-frame.html: All classes for display in lower-left frame
0.2i help-doc.html: Help about Javadoc page organization
0.2i index-all.html: Default index created without \f3-splitindex option
0.2i index-files: Directory created with \f3-splitindex option
0.2i index-<number>.html: Index files created with \f3-splitindex option
0.2i package-list: Package names for resolving external references
0.2i stylesheet.css: Defines fonts, colors, positions, and so on
0.2i java: Package directory
0.2i applet: Subpackage directory
0.2i Applet.html: \f3Applet class page
0.2i AppletContext.html: \f3AppletContext interface
0.2i AppletStub.html: \f3AppletStub interface
0.2i AudioClip.html: \f3AudioClip interface
0.2i package-summary.html: Classes with summaries
0.2i package-frame.html: Package classes for display in lower-left frame
0.2i package-tree.html: Class hierarchy for this package
0.2i package-use.html: Where this package is used
0.2i doc-files: Image and example files directory
0.2i class-use: Image and examples file location - Applet.html: Uses of the Applet class - AppletContext.html: Uses of the \f3AppletContext interface - AppletStub.html: Uses of the \f3AppletStub interface - AudioClip.html: Uses of the \f3AudioClip interface
0.2i src-html: Source code directory
0.2i java: Package directory
0.2i applet: Subpackage directory - Applet.html: Applet source code - AppletContext.html: \f3AppletContext source code - AppletStub.html: \f3AppletStub source code - AudioClip.html: \f3AudioClip source code
\f3public final class Boolean
\f3extends Object
\f3implements Serializable
\f3The declaration for the \f3Boolean.valueOf method is:
\f3public static Boolean valueOf(String s)
\f3The \f3javadoc command can include the modifiers \f3public, \f3protected, \f3private, \f3abstract, \f3final, \f3static, \f3transient, and \f3volatile, but not \f3synchronized or \f3native. The \f3synchronized and \f3native modifiers are considered implementation detail and not part of the API specification.
Rather than relying on the keyword \f3synchronized, APIs should document their concurrency semantics in the main description of the comment. For example, a description might be: A single enumeration cannot be used by multiple threads concurrently. The document should not describe how to achieve these semantics. As another example, while the \f3Hashtable option should be thread-safe, there is no reason to specify that it is achieved by synchronizing all of its exported methods. It is better to reserve the right to synchronize internally at the bucket level for higher concurrency.
\f3/**
\f3 * This is the typical format of a simple documentation comment
\f3 * that spans two lines.
\f3 */
\f3To save space you can put a comment on one line:
\f3/** This comment takes up only one line. */
\f3
Placement of Comments Documentation comments are recognized only when placed immediately before class, interface, constructor, method, or field declarations. Documentation comments placed in the body of a method are ignored. The \f3javadoc command recognizes only one documentation comment per declaration statement. See Where Tags Can Be Used.
A common mistake is to put an \f3import statement between the class comment and the class declaration. Do not put an \f3import statement at this location because the \f3javadoc command ignores the class comment.
\f3/**
\f3 * This is the class comment for the class Whatever.
\f3 */
\f3
\f3import com.example; // MISTAKE - Important not to put import statement here
\f3
\f3public class Whatever{ }
\f3
Parts of Comments A documentation comment has a main description followed by a tag section. The main description begins after the starting delimiter \f3/** and continues until the tag section. The tag section starts with the first block tag, which is defined by the first \f3@ character that begins a line (ignoring leading asterisks, white space, and leading separator \f3/**). 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, and some types of tags can be repeated while others cannot. For example, this \f3@see tag starts the tag section:
\f3/**
\f3 * This sentence holds the main description for this documentation comment.
\f3 * @see java.lang.Object
\f3 */
\f3
Block and inline Tags A tag is a special keyword within a documentation comment that the \f3javadoc command processes. There are two kinds of tags: block tags, which appear as an \f3@tag tag (also known as standalone tags), and inline tags, which appear within braces, as an \f3{@tag} tag. To be interpreted, a block tag must appear at the beginning of a line, ignoring leading asterisks, white space, and the separator (\f3/**). This means you can use the \f3@ 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 \f3@ character and not have it be interpreted, then use the HTML entity \f3@. 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 documentation comment. This associated text can span multiple lines. An inline tag is allowed and interpreted anywhere that text is allowed. The following example contains the \f3@deprecated block tag and the \f3{@link} inline tag. See Javadoc Tags.
\f3/**
\f3 * @deprecated As of JDK 1.1, replaced by {@link #setBounds(int,int,int,int)}
\f3 */
\f3
Write Comments in HTML The text must be written in HTML with HTML entities and HTML tags. You can use whichever version of HTML your browser supports. The standard doclet generates HTML 3.2-compliant code elsewhere (outside of the documentation comments) with the inclusion of cascading style sheets and frames. HTML 4.0 is preferred for generated files because of the frame sets.
For example, entities for the less than symbol (<) and the greater than symbol (>) should be written as \f3< and \f3>. Similarly, the ampersand (&) should be written as \f3&. The bold HTML tag \f3<b> is shown in the following example.
\f3/**
\f3 * This is a <b>doc</b> comment.
\f3 * @see java.lang.Object
\f3 */
\f3
Leading Asterisks When the \f3javadoc command parses a documentation comment, leading asterisks (*) on each line are discarded, and blanks and tabs that precede the initial asterisks (*) are also discarded. If you omit the leading asterisk on a line, then the leading white space is no longer removed so that you can paste code examples directly into a documentation comment inside a \f3<PRE> tag with its indentation preserved. Spaces are interpreted by browsers more uniformly than tabs. Indentation is relative to the left margin (rather than the separator \f3/** or \f3<PRE> tag).
First Sentence The first sentence of each documentation comment should be a summary sentence that contains 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 \f3javadoc command copies this first sentence to the member summary at the top of the HTML page.
Multiple-Field Declarations The Java platform lets you declare multiple fields in a single statement, but this statement can have only one documentation comment that is copied for all fields. If you want individual documentation comments for each field, then declare each field in a separate statement. For example, the following documentation comment does not make sense written as a single declaration and would be better handled as two declarations:
\f3/**
\f3 * The horizontal and vertical distances of point (x,y)
\f3 */
\f3public int x, y; // Avoid this
\f3The \f3javadoc command generates the following documentation from the previous code:
\f3public int x
\f3The horizontal and vertical distances of point (x, y).
\f3public int y
\f3The horizontal and vertical distances of point (x, y).
Use of Header Tags When writing documentation comments for members, it is best not to use HTML heading tags such as \f3<H1> and \f3<H2>, because the \f3javadoc command creates an entire structured document, and these structural tags might interfere with the formatting of the generated document. However, you can use these headings in class and package comments to provide your own structure.
Note: The source file for an inherited method must be on the path specified by the \f3-sourcepath option for the documentation comment to be available to copy. Neither the class nor its package needs to be passed in on the command line. This contrasts with Release 1.3.n and earlier releases, where the class had to be a documented class.
Fill in Missing Text When a main description, or \f3@return, \f3@param, or \f3@throws tag is missing from a method comment, the \f3javadoc command copies the corresponding main description or tag comment from the method it overrides or implements (if any). See Method Comment Inheritance.
When an \f3@param tag for a particular parameter is missing, the comment for that parameter is copied from the method further up the inheritance hierarchy. When an \f3@throws tag for a particular exception is missing, the \f3@throws tag is copied only when that exception is declared.
This behavior contrasts with Release 1.3 and earlier, where the presence of any main description or tag would prevent all comments from being inherited.
See Javadoc Tags and Options.
Explicit Inheritance Insert the \f3{@inheritDoc} inline tag in a method main description or \f3@return, \f3@param, or \f3@throws tag comment. The corresponding inherited main description or tag comment is copied into that spot.
0.2i When a method in a class overrides a method in a superclass
0.2i When a method in an interface overrides a method in a superinterface
0.2i When a method in a class implements a method in an interface
In the first two cases, the \f3javadoc command generates the subheading Overrides in the documentation for the overriding method. A link to the method being overridden is included, whether or not the comment is inherited.
In the third case, when a method in a specified class implements a method in an interface, the \f3javadoc command generates the subheading Specified by in the documentation for the overriding method. A link to the method being implemented is included, whether or not the comment is inherited.
0.4i 1. Look in each directly implemented (or extended) interface in the order they appear following the word \f3implements (or \f3extends) in the method declaration. Use the first documentation comment found for this method.
0.4i 2. If Step 1 failed to find a documentation comment, then recursively apply this entire algorithm to each directly implemented (or extended) interface in the same order they were examined in Step 1.
0.4i 3. When Step 2 fails to find a documentation comment and this is a class other than the \f3Object class, but not an interface:
0.4i 1. If the superclass has a documentation comment for this method, then use it.
0.4i 2. If Step 3a failed to find a documentation comment, then recursively apply this entire algorithm to the superclass.
Tags have the following types:
0.2i Bock tags: Place block tags only in the tag section that follows the description. Block tags have the form: @tag.
0.2i Inline tags: Place inline tags anywhere in the main description or in the comments for block tags. Inline tags are enclosed within braces: {@tag}.
For custom tags, see -tag tagname:Xaoptcmf:"taghead". See also Where Tags Can Be Used.
@author name-text Introduced in JDK 1.0 Adds an Author entry with the specified name text to the generated documents when the \f3-author option is used. A documentation comment can contain multiple \f3@author tags. You can specify one name per \f3@author tag or multiple names per tag. In the former case, the \f3javadoc command inserts a comma (,) and space between names. In the latter case, the entire text is 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 a comma. See @author in How to Write Doc Comments for the Javadoc Tool at http://www.oracle.com/technetwork/java/javase/documentation/index-137868.html#@author
{@code text} Introduced in JDK 1.5 Equivalent to \f3<code>{@literal}</code>. Displays text in code font without interpreting the text as HTML markup or nested Javadoc tags. This enables you to use regular angle brackets (< and >) instead of the HTML entities (\f3< and \f3>) in documentation comments, such as in parameter types (\f3<Object>), inequalities (\f33 < 4), or arrows (\f3<-). For example, the documentation comment text \f3{@code A<B>C} displayed in the generated HTML page unchanged as \f3A<B>C. This means that the \f3<B> is not interpreted as bold and is in code font. If you want the same functionality without the code font, then use the \f3{@literal} tag.
@deprecated deprecated-text Introduced in JDK 1.0 Adds a comment indicating that this API should no longer be used (even though it may continue to work). The \f3javadoc command moves \f3deprecated-textahead of the main description, placing it in italics and preceding it with a bold warning: Deprecated. This tag is valid in all documentation comments: overview, package, class, interface, constructor, method and field. The first sentence of deprecated text should tell the user when the API was deprecated and what to use as a replacement. The \f3javadoc command copies the first sentence to the summary section and index. Subsequent sentences can also explain why it was deprecated. You should include an \f3{@link} tag (for Javadoc 1.2 or later) that points to the replacement API. Use the @deprecated annotation tag to deprecate a program element. See How and When to Deprecate APIs at http://docs.oracle.com/javase/8/docs/technotes/guides/javadoc/deprecation/deprecation.html See also @deprecated in How to Write Doc Comments for the Javadoc Tool at http://www.oracle.com/technetwork/java/javase/documentation/index-137868.html#@deprecated
{@docRoot} Introduced in JDK 1.3 Represents the relative path to the generated document's (destination) root directory from any generated page. This tag 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. This \f3{@docRoot} tag can be used both on the command line and in a documentation comment. This tag is valid in all documentation comments: overview, package, class, interface, constructor, method and field, and includes the text portion of any tag (such as the \f3@return, \f3@param and \f3@deprecated tags).
0.2i On the command line, where the header, footer, or bottom are defined: \f3javadoc -bottom '<a href="{@docRoot}/copyright.html">Copyright</a>'. When you use the \f3{@docRoot} tag this way in a make file, some \f3makefile programs require a special way to escape for the brace \f3{} characters. For example, the Inprise MAKE version 5.2 running on Windows requires double braces: \f3{{@docRoot}}. It also requires double (rather than single) quotation marks to enclose arguments to options such as the \f3-bottom option (with the quotation marks around the \f3href argument omitted).
0.2i In a documentation comment:
\f3/**
\f3 * See the <a href="{@docRoot}/copyright.html">Copyright</a>.
\f3 */
\f3This tag is needed because the generated documents are in hierarchical directories, as deep as the number of subpackages. The expression: \f3<a href="{@docRoot}/copyright.html"> resolves to \f3<a href="../../copyright.html"> for \f3java/lang/Object.java and \f3<a href="../../../copyright.html"> for \f3java/lang/ref/Reference.java.
@exception class-name description Introduced in JDK 1.0 Identical to the \f3@throws tag. See @throws class-name description.
{@inheritDoc} Introduced in JDK 1.4 Inherits (copies) documentation from the nearest inheritable class or implementable interface into the current documentation comment at this tag's location. This enables you to write more general comments higher up the inheritance tree and to write around the copied text. This tag is valid only in these places in a documentation comment:
0.2i In the main description block of a method. In this case, the main description is copied from a class or interface up the hierarchy.
0.2i In the text arguments of the \f3@return, \f3@param, and \f3@throws tags of a method. In this case, the tag text is copied from the corresponding tag up the hierarchy.
{@link package.class#member label} Introduced in JDK 1.2 Inserts an inline link with a visible text label that points to the documentation for the specified package, class, or member name of a referenced class. This tag is valid in all documentation comments: overview, package, class, interface, constructor, method and field, including the text portion of any tag, such as the \f3@return, \f3@param and \f3@deprecated tags. See @link in How to Write Doc Comments for the Javadoc Tool at http://www.oracle.com/technetwork/java/javase/documentation/index-137868.html#{@link This tag is similar to the \f3@see tag. Both tags require the same references and accept the same syntax for \f3package.class#member and \f3label. The main difference is that the \f3{@link} tag generates an inline link rather than placing the link in the See Also section. The \f3{@link} tag begins and ends with braces to separate it from the rest of the inline text. If you need to use the right brace (\f3}) inside the label, then use the HTML entity notation \f3}. There is no limit to the number of \f3{@link} 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 the \f3@deprecated, \f3@return or \f3@param tags. For example, here is a comment that refers to the \f3getComponentAt(int, int) method:
\f3Use the {@link #getComponentAt(int, int) getComponentAt} method.
\f3From this code, the standard doclet generates the following HTML (assuming it refers to another class in the same package):
\f3Use the <a href="Component.html#getComponentAt(int, int)">getComponentAt</a> method.
\f3The previous line appears on the web page as:
\f3Use the getComponentAt method.
\f3
{@linkplain package.class#member label} Introduced in JDK 1.4 Behaves the same as the \f3{@link} tag, except the link label is displayed in plain text rather than code font. Useful when the label is plain text. For example, \f3Refer to {@linkplain add() the overridden method}. displays as: Refer to the overridden method.
{@literal text} Introduced in JDK 1.5 Displays text without interpreting the text as HTML markup or nested Javadoc tags. This enables you to use angle brackets (\f3< and >) instead of the HTML entities (\f3< and \f3>) in documentation comments, such as in parameter types (\f3<Object>), inequalities (\f33 < 4), or arrows (<-). For example, the documentation comment text \f3{@literal A<B>C} displays unchanged in the generated HTML page in your browser, as \f3A<B>C. The \f3<B> is not interpreted as bold (and it is not in code font). If you want the same functionality with the text in code font, then use the \f3{@code} tag.
@param parameter-name description Introduced in JDK 1.0 Adds a parameter with the specified \f3parameter-name followed by the specified description to the Parameters section. When writing the documentation comment, you can continue the description onto multiple lines. This tag is valid only in a documentation comment for a method, constructor, or class. See @param in How to Write Doc Comments for the Javadoc Tool at http://www.oracle.com/technetwork/java/javase/documentation/index-137868.html#@param The \f3parameter-name 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. Example of a type parameter of a class:
\f3/**
\f3 * @param <E> Type of element stored in a list
\f3 */
\f3public interface List<E> extends Collection<E> {
\f3}
\f3Example of a type parameter of a method:
\f3/**
\f3 * @param string the string to be converted
\f3 * @param type the type to convert the string to
\f3 * @param <T> the type of the element
\f3 * @param <V> the value of the element
\f3 */
\f3<T, V extends T> V convert(String string, Class<T> type) {
\f3}
\f3
@return description Introduced in JDK 1.0 Adds a Returns section with the description text. This text should describe the return type and permissible range of values. This tag is valid only in a documentation comment for a method. See @return in How to Write Doc Comments for the Javadoc Tool at http://www.oracle.com/technetwork/java/javase/documentation/index-137868.html#@return
@see reference Introduced in JDK 1.0 Adds a See Also heading with a link or text entry that points to a reference. A documentation comment can contain any number of \f3@see tags, which are all grouped under the same heading. The \f3@see tag has three variations. The form is the most common. This tag is valid in any documentation comment: overview, package, class, interface, constructor, method, or field. For inserting an inline link within a sentence to a package, class, or member, see \f3{@link}. Form 1. The @see \f3string tag form adds a text entry for string. No link is generated. The string is a book or other reference to information not available by URL. The \f3javadoc command distinguishes this from the previous cases by searching for a double quotation mark (") as the first character. For example, \f3@see "The Java Programming Language" that generates the following text: See Also: "The Java Programming Language" Form 2. The \f3@see <a href="URL#value">label</a> form adds a link as defined by \f3URL#value. The \f3URL#value parameter is a relative or absolute URL. The \f3javadoc command distinguishes this from other cases by searching for a less-than symbol (\f3<) as the first character. For example, \f3@see <a href="spec.html#section">Java Spec</a> generates the following link: See Also: Java Spec Form 3. The \f3@see package.class#member label form adds a link with a visible text label that points to the documentation for the specified name in the Java Language that is referenced. The label is optional. If the label is omitted, then the name appears instead as visible text, suitably shortened. Use the \f3-noqualifier option to globally remove the package name from this visible text. Use the label when you want the visible text to be different from the autogenerated visible text. See How a Name Appears. In Java SE 1.2 only, the name but not the label automatically appears in \f3<code> HTML tags. Starting with Java SE 1.2.2, the \f3<code> tag is always included around the visible text, whether or not a label is used.
0.2i \f3package.class#member is any valid program element name that is referenced, such as a package, class, interface, constructor, method or field name, except that the character ahead of the member name should be a number sign (\f3#). The class represents any top-level or nested class or interface. The member represents any constructor, method, or field (not a nested class or interface). If this name is in the documented classes, then the \f3javadoc command create a link to it. To create links to external referenced classes, use the \f3-link option. Use either of the other two \f3@see tag forms to refer to the documentation of a name that does not belong to a referenced class. See Specify a Name. Note: External referenced classes are classes that are not passed into the \f3javadoc command on the command line. Links in the generated documentation to external referenced classes are called external references or external links. For example, if you run the \f3javadoc command on only the \f3java.awt package, then any class in \f3java.lang, such as \f3Object, is an external referenced class. Use the \f3-link and \f3-linkoffline options to link to external referenced classes. The source comments of external referenced classes are not available to the \f3javadoc command run.
0.2i \f3label is optional text that is visible as the link label. The label can contain white space. If \f3label is omitted, then \f3package.class.member appears, suitably shortened relative to the current class and package. See How a Name Appears.
0.2i A space is the delimiter between \f3package.class#member and \f3label. A space inside parentheses does not indicate the start of a label, so spaces can be used between parameters in a method.
\f3/**
\f3 * @see String#equals(Object) equals
\f3 */
\f3The standard doclet produces HTML that is similar to:
\f3<dl>
\f3<dt><b>See Also:</b>
\f3<dd><a href="../../java/lang/String#equals(java.lang.Object)"><code>equals<code></a>
\f3</dl>
\f3The previous code looks similar to the following in a browser, where the label is the visible link text: See Also: equals
Specify a Name This \f3package.class#member name can be either fully qualified, such as \f3java.lang.String#toUpperCase() or not, such as \f3String#toUpperCase() or \f3#toUpperCase(). If the name is less than fully qualified, then the \f3javadoc command uses the standard Java compiler search order to find it. See Search Order for the @see Tag. The name can contain white space within parentheses, such as between method arguments.The advantage to providing shorter, partially qualified names is that they are shorter to type and there is less clutter in the source code. The following listing shows the different forms of the name, where \f3Class can be a class or interface; Type can be a class, interface, array, or primitive; and method can be a method or constructor.
\f3Typical forms for @see package.class#member
\f3Referencing a member of the current class
\f3@see #field
\f3@see #method(Type, Type,...)
\f3@see #method(Type argname, Type argname,...)
\f3@see #constructor(Type, Type,...)
\f3@see #constructor(Type argname, Type argname,...)
\f3
\f3Referencing another class in the current or imported packages
\f3@see Class#field
\f3@see Class#method(Type, Type,...)
\f3@see Class#method(Type argname, Type argname,...)
\f3@see Class#constructor(Type, Type,...)
\f3@see Class#constructor(Type argname, Type argname,...)
\f3@see Class.NestedClass
\f3@see Class
\f3
\f3Referencing an element in another package (fully qualified)
\f3@see package.Class#field
\f3@see package.Class#method(Type, Type,...)
\f3@see package.Class#method(Type argname, Type argname,...)
\f3@see package.Class#constructor(Type, Type,...)
\f3@see package.Class#constructor(Type argname, Type argname,...)
\f3@see package.Class.NestedClass
\f3@see package.Class
\f3@see package
\f3\f3Notes about the previous listing:
0.2i The first set of forms with no class or package causes the \f3javadoc command to search only through the current class hierarchy. It finds a member of the current class or interface, one of its superclasses or superinterfaces, or one of its enclosing classes or interfaces (search Items 1\(en3). It does not search the rest of the current package or other packages (search Items 4\(en5). See Search Order for the @see Tag.
0.2i If any method or constructor is entered as a name with no parentheses, such as \f3getValue, and if there is no field with the same name, then the \f3javadoc command still creates a link to the method. If this method is overloaded, then the \f3javadoc command links to the first method its search encounters, which is unspecified.
0.2i Nested classes must be specified as \f3outer.inner, not simply \f3inner, for all forms.
0.2i As stated, the number sign (\f3#), rather than a dot (\f3.) separates a member from its class. This enables the \f3javadoc command to resolve ambiguities, because the dot also separates classes, nested classes, packages, and subpackages. However, the \f3javadoc command properly parses a dot when there is no ambiguity, but prints a warning to alert you.
Search Order for the @see Tag The \f3javadoc command processes an \f3@see tag that appears in a source file, package file, or overview file. In the latter two files, you must fully qualify the name you supply with the \f3@see tag. In a source file, you can specify a name that is fully qualified or partially qualified.
The following is the search order for the \f3@see tag.
0.4i 1. The current class or interface.
0.4i 2. Any enclosing classes and interfaces searching the closest first.
0.4i 3. Any superclasses and superinterfaces, searching the closest first.
0.4i 4. The current package.
0.4i 5. Any imported packages, classes, and interfaces, searching in the order of the \f3import statement.
The \f3javadoc command continues to search recursively through Items 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 searches through the superclasses of E before the enclosing classes of E. In Items 4 and 5, the \f3javadoc command does not search classes or interfaces within a package in any specified order (that order depends on the particular compiler). In Item 5, the \f3javadoc command searches in java.lang because that is imported by all programs.
When the \f3javadoc command encounters an \f3@see tag in a source file that is not fully qualified, it searches for the specified name in the same order as the Java compiler would, except the \f3javadoc command does not detect certain name space ambiguities because it assumes the source code is free of these errors. This search order is formally defined in the Java Language Specification. The \f3javadoc command searches for that name through all related and imported classes and packages. In particular, it searches in this order:
0.4i 1. The current class or interface.
0.4i 2. Any enclosing classes and interfaces, searching the closest first.
0.4i 3. Any superclasses and superinterfaces, searching the closest first.
0.4i 4. The current package.
0.4i 5. Any imported packages, classes, and interfaces, searching in the order of the \f3import statements.
The \f3javadoc command does not necessarily look in subclasses, nor will it look in other packages even when their documentation is being generated in the same run. For example, if the \f3@see tag is in the \f3java.awt.event.KeyEvent class and refers to a name in the \f3java.awt package, then the \f3javadoc command does not look in that package unless that class imports it.
How a Name Appears If \f3label is omitted, then \f3package.class.member appears. In general, it is suitably shortened relative to the current class and package. Shortened means the \f3javadoc command displays only the minimum name necessary. For example, if the \f3String.toUpperCase() method contains references to a member of the same class and to a member of a different class, then the class name is displayed only in the latter case, as shown in the following listing. Use the \f3-noqualifier option to globally remove the package names.
Type of reference: The \f3@see tag refers to a member of the same class, same package
Example in: \f3@see String#toLowerCase()
Appears as: \f3toLowerCase() - omits the package and class names
Type of reference: The \f3@see tag refers to a member of a different class, same package
Example in: \f3@see Character#toLowerCase(char)
Appears as: \f3Character.toLowerCase(char) - omits the package name, includes the class name
Type of reference: The \f3@see tag refers to a member of a different class, different package
Example in: \f3@see java.io.File#exists()
Appears as: \f3java.io.File.exists() - includes the package and class names
Examples of the @see Tag The comment to the right shows how the name appears when the \f3@see tag is in a class in another package, such as \f3java.applet.Applet. See @see in How to Write Doc Comments for the Javadoc Tool at http://www.oracle.com/technetwork/java/javase/documentation/index-137868.html#@see
\f3 See also:
\f3@see java.lang.String // String
\f3@see java.lang.String The String class // The String class
\f3@see String // String
\f3@see String#equals(Object) // String.equals(Object)
\f3@see String#equals // String.equals(java.lang.Object)
\f3@see java.lang.Object#wait(long) // java.lang.Object.wait(long)
\f3@see Character#MAX_RADIX // Character.MAX_RADIX
\f3@see <a href="spec.html">Java Spec</a> // Java Spec
\f3@see "The Java Programming Language" // "The Java Programming Language"
\f3Note: You can extend the \f3@se\f3e tag to link to classes not being documented with the \f3-link option.
@serial field-description | include | exclude Introduced in JDK 1.2 Used in the documentation comment for a default serializable field. See Documenting Serializable Fields and Data for a Class at http://docs.oracle.com/javase/8/docs/platform/serialization/spec/serial-arch.html#5251 See also Oracle\(cqs Criteria for Including Classes in the Serialized Form Specification at http://www.oracle.com/technetwork/java/javase/documentation/serialized-criteria-137781.html An optional \f3field-description should explain the meaning of the field and list the acceptable values. When needed, the description can span multiple lines. The standard doclet adds this information to the serialized form page. See Cross-Reference Pages. If a serializable field was added to a class after the class was made serializable, then a statement should be added to its main description to identify at which version it was added. The \f3include and \f3exclude arguments identify whether a class or package should be included or excluded from the serialized form page. They work as follows:
0.2i A public or protected class that implements \f3Serializable is included unless that class (or its package) is marked with the \f3@serial exclude tag.
0.2i A private or package-private class that implements \f3Serializable is excluded unless that class (or its package) is marked with the \f3@serial include tag.
@serialData data-description Introduced in JDK 1.2 Uses the data description value to document the types and order of data in the serialized form. This data includes the optional data written by the \f3writeObject method and all data (including base classes) written by the \f3Externalizable.writeExternal method. The \f3@serialData tag can be used in the documentation comment for the \f3writeObject, \f3readObject, \f3writeExternal, \f3readExternal, \f3writeReplace, and \f3readResolve methods.
@serialField field-namefield-typefield-description Introduced in JDK 1.2 Documents an \f3ObjectStreamField component of the \f3serialPersistentFields member of a \f3Serializable class. Use one \f3@serialField tag for each \f3ObjectStreamField component.
@since since-text Introduced in JDK 1.1 Adds a Since heading with the specified \f3since-text value to the generated documentation. The text has no special internal structure. This tag is valid in any documentation 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 \f3since-text value, for example: \f3@since 1.5. For Java platform source code, the \f3@since tag indicates the version of the Java platform API specification, which is not necessarily when the source code was added to the reference implementation. Multiple \f3@since tags are allowed and are treated like multiple \f3@author tags. You could use multiple tags when the program element is used by more than one API.
@throws class-namedescription Introduced in JDK 1.2 Behaves the same as the \f3@exception tag. See @throws in How to Write Doc Comments for the Javadoc Tool at http://www.oracle.com/technetwork/java/javase/documentation/index-137868.html#@exception The \f3@throws tag adds a Throws subheading to the generated documentation, with the \f3class-name and \f3description text. The class-name is the name of the exception that might be thrown by the method. This tag is valid only in the documentation comment for a method or constructor. If this class is not fully specified, then the \f3javadoc command uses the search order to look up this class. Multiple \f3@throws tags can be used in a specified documentation comment for the same or different exceptions. See Search Order for the @see Tag. To ensure that all checked exceptions are documented, when an \f3@throws tag does not exist for an exception in the throws clause, the \f3javadoc command adds that exception to the HTML output (with no description) as though it were documented with the \f3@throws tag. The \f3@throws 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 the \f3{@inheritDoc} tag to force the \f3@throws tag to inherit documentation.
{@value package.class#field} Introduced in JDK 1.4 Displays constant values. When the \f3{@value} tag is used without an argument in the documentation comment of a static field, it displays the value of that constant:
\f3/**
\f3 * The value of this constant is {@value}.
\f3 */
\f3public static final String SCRIPT_START = "<script>"
\f3When used with the argument \f3package.class#field in any documentation comment, he \f3{@value} tag displays the value of the specified constant:
\f3/**
\f3 * Evaluates the script starting with {@value #SCRIPT_START}.
\f3 */
\f3public String evalScript(String script) {}
\f3The argument \f3package.class#field takes a form similar to that of the \f3@see tag argument, except that the member must be a static field. The values of these constants are also displayed in Constant Field Values at http://docs.oracle.com/javase/8/docs/api/constant-values.html
@version version-text Introduced in JDK 1.0 Adds a Version subheading with the specified \f3version-text value to the generated documents when the \f3-version option is used. This tag is intended to hold the current release number of the software that this code is part of, as opposed to the\f3@since tag, which holds the release number where this code was introduced. The \f3version-text value has no special internal structure. See @version in How to Write Doc Comments for the Javadoc Tool at http://www.oracle.com/technetwork/java/javase/documentation/index-137868.html#@version A documentation comment can contain multiple \f3@version tags. When it makes sense, you can specify one release number per \f3@version tag or multiple release numbers per tag. In the former case, the \f3javadoc command inserts a comma (,) and a space between the names. In the latter case, the entire text is copied to the generated document without being parsed. Therefore, you can use multiple names per line when you want a localized name separator other than a comma.
Note: The \f3{@link} tag has a bug in overview documents in Java SE 1.2. The text appears correctly but has no link. The \f3{@docRoot} tag does not currently work in overview documents.
The overview tags are the following:
@see reference || @since since-text || @serialField field-name field-type field-description || @author name-text || @version version-text || {@link package.class#member label} || {@linkplain package.class#member label} || {@docRoot} ||
The package tags are the following:
@see reference || @since since-text || @serial field-description | include | exclude || @author name-text || @version version-text || {@linkplain package.class#member label} || {@linkplain package.class#member label} || {@docRoot} ||
@see reference || @since since-text || @deprecated deprecated-text || @serial field-description | include | exclude || @author name-text || @version version-text || {@link package.class#member label} || {@linkplain package.class#member label} || {@docRoot} ||
Class comment example:
\f3/**
\f3 * A class representing a window on the screen.
\f3 * For example:
\f3 * <pre>
\f3 * Window win = new Window(parent);
\f3 * win.show();
\f3 * </pre>
\f3 *
\f3 * @author Sami Shaio
\f3 * @version 1.13, 06/08/06
\f3 * @see java.awt.BaseWindow
\f3 * @see java.awt.Button
\f3 */
\f3class Window extends BaseWindow {
\f3 ...
\f3}
\f3
@see reference || @since since-text || @deprecated deprecated-text || @serial field-description | include | exclude || @serialField field-name field-type field-description || {@link package.class#member label} || {@linkplain package.class#member label} || {@docRoot} || {@value package.class#field}
Field comment example:
\f3 /**
\f3 * The X-coordinate of the component.
\f3 *
\f3 * @see #getLocation()
\f3 */
\f3 int x = 1263732;
\f3
@see reference || @since since-text || @deprecated deprecated-text || @param parameter-name description || @return description || @throws class-name description || @exception class-name description || @serialData data-description || {@link package.class#member label} || {@linkplain package.class#member label} || {@inheritDoc} || {@docRoot}
Note: The \f3@serialData tag can only be used in the documentation comment for the \f3writeObject, \f3readObject, \f3writeExternal, \f3readExternal, \f3writeReplace, and \f3readResolve methods.
Method comment example:
\f3/**
\f3 * Returns the character at the specified index. An index
\f3 * ranges from <code>0</code> to <code>length() - 1</code>
\f3 *
\f3 * @param index the index of the desired character.
\f3 * @return the desired character.
\f3 * @exception StringIndexOutOfRangeException
\f3 * if the index is not in the range <code>0</code>
\f3 * to <code>length()-1</code>
\f3 * @see java.lang.Character#charValue()
\f3 */
\f3 public char charAt(int index) {
\f3 ...
\f3 }
\f3
0.2i See also Javadoc Options
0.2i See also Standard Doclet Options
The options are:
-1.1 || -author || -bootclasspath classpathlist || -bottom text || -breakiterator || -charset name || -classpath classpathlist || -d directory || -docencoding name || -docfilesubdirs || -doclet class || -docletpath classpathlist || -doctitle title || -encoding || -exclude packagename1:packagename2:... || -excludedocfilessubdir name1:name2 || -extdirs dirist || -footer footer || -group groupheading packagepattern:packagepattern || -header header || -help || -helpfile path\efilename || -Jflag || -javafx ||-keywords || -link extdocURL || -linkoffline extdocURL packagelistLoc || -linksource || -locale language_country_variant || -nocomment || -nodeprecated || -nodeprecatedlist || -nohelp || -noindex || -nonavbar || -noqualifier all | packagename1:packagename2... || -nosince || -notimestamp || -notree || -overview path/filename || -package || -private || -protected || -public || -quiet || -serialwarn || -source release || -sourcepath sourcepathlist || -sourcetab tablength || -splitindex || -stylesheet path/filename || -subpackages package1:package2:... || -tag tagname:Xaoptcmf:"taghead" || -taglet class || -tagletpath tagletpathlist || -title title || -top || -use || -verbose || -version || -windowtitle title
The following options are the core Javadoc options that are available to all doclets. The standard doclet provides the rest of the doclets: \f3-bootclasspath, \f3-breakiterator, \f3-classpath, \f3-doclet, \f3-docletpath, \f3-encoding, -\f3exclude, \f3-extdirs, \f3-help, \f3-locale, \f3-\f3overview, \f3-package, \f3-private, \f3-protected, \f3-public, \f3-quiet, \f3-source, \f3-sourcepath, \f3-subpackages, and \f3-verbose.
Specifies that the \f3javadoc command should retrieve the text for the overview documentation from the source file specified by the path/filenameand place it on the Overview page (overview-summary.html). The path/filenameis relative to the current directory. While you can use any name you want for the \f3filename value and place it anywhere you want for the path, it is typical to name it overview.html and place it in the source tree at the directory that contains the topmost package directories. In this location, no path is needed when documenting packages, because the \f3-sourcepath option points to this file. For example, if the source tree for the \f3java.lang package is /src/classes/java/lang/, then you could place the overview file at /src/classes/overview.html See Real-World Examples. For information about the file specified by path/filename,see Overview Comment Files. The overview page is created only when you pass two or more package names to the \f3javadoc command. For a further explanation, see HTML Frames. The title on the overview page is set by \f3-doctitle.
-Xdoclint:(all|none|[-]<group>)
Reports warnings for bad references, lack of accessibility and missing Javadoc comments, and reports errors for invalid Javadoc syntax and missing HTML tags. This option enables the \f3javadoc command to check for all documentation comments included in the generated output. As always, you can select which items to include in the generated output with the standard options \f3-public, \f3-protected, \f3-package and \f3-private. When the \f3-Xdoclint is enabled, it reports issues with messages similar to the \f3javac command. The \f3javadoc command prints a message, a copy of the source line, and a caret pointing at the exact position where the error was detected. Messages may be either warnings or errors, depending on their severity and the likelihood to cause an error if the generated documentation were run through a validator. For example, bad references or missing Javadoc comments do not cause the \f3javadoc command to generate invalid HTML, so these issues are reported as warnings. Syntax errors or missing HTML end tags cause the \f3javadoc command to generate invalid output, so these issues are reported as errors. By default, the \f3-Xdoclint option is enabled. Disable it with the option \f3-Xdoclint:none. Change what the \f3-Xdoclint option reports with the following options:
0.2i \f3-Xdoclint none : disable the \f3-Xdoclint option
0.2i \f3-Xdoclintgroup : enable group checks
0.2i \f3-Xdoclint all : enable all groups of checks
0.2i \f3-Xdoclint all,-group : enable all except group checks
0.2i \f3accessibility : Checks for the issues to be detected by an accessibility checker (for example, no caption or summary attributes specified in a \f3<table> tag).
0.2i \f3html : Detects high-level HTML issues, like putting block elements inside inline elements, or not closing elements that require an end tag. The rules are derived from theHTML 4.01 Specification. This type of check enables the \f3javadoc command to detect HTML issues that many browsers might accept.
0.2i \f3missing : Checks for missing Javadoc comments or tags (for example, a missing comment or class, or a missing \f3@return tag or similar tag on a method).
0.2i \f3reference : Checks for issues relating to the references to Java API elements from Javadoc tags (for example, item not found in \f3@see , or a bad name after \f3@param).
0.2i \f3syntax : Checks for low level issues like unescaped angle brackets (\f3< and \f3>) and ampersands (\f3&) and invalid Javadoc tags.
\f3javadoc -Xdoclint:html -Xdoclint:syntax -Xdoclint:accessibility filename
\f3javadoc -Xdoclint:html,syntax,accessibility filename
\f3Note: The \f3javadoc command does not guarantee the completeness of these checks. In particular, it is not a full HTML compliance checker. The goal of the -\f3Xdoclint option is to enable the \f3javadoc command to report majority of common errors. The \f3javadoc command does not attempt to fix invalid input, it just reports it.
-public
Shows only public classes and members.
-protected
Shows only protected and public classes and members. This is the default.
-package
Shows only package, protected, and public classes and members.
-private
Shows all classes and members.
-help
Displays the online help, which lists all of the \f3javadoc and \f3doclet command-line options.
-doclet class
Specifies 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 \f3-doclet option is not used, then the \f3javadoc command uses the standard doclet for generating the default HTML format. This class must contain the \f3start(Root) method. The path to this starting class is defined by the \f3-docletpath option. See Doclet Overview at http://docs.oracle.com/javase/8/docs/technotes/guides/javadoc/doclet/overview.html
-docletpath classpathlist
Specifies the path to the doclet starting class file (specified with the \f3-doclet option) and any JAR files it depends on. If the starting class file is in a JAR file, then this option specifies the path to that JAR file. You can specify an absolute path or a path relative to the current directory. If \f3classpathlist contains multiple paths or JAR files, then they should be separated with a colon (:) on Oracle Solaris and a semi-colon (;) on Windows. This option is not necessary when the doclet starting class is already in the search path. See Doclet Overview at http://docs.oracle.com/javase/8/docs/technotes/guides/javadoc/doclet/overview.html
-1.1
Removed from Javadoc 1.4 with no replacement. 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, then use Javadoc 1.2 or 1.3 instead.
-source release
Specifies the release of source code accepted. The following values for the \f3release parameter are allowed. Use the value of \f3release that corresponds to the value used when you compile code with the \f3javac command.
0.2i Release Value: 1.5. The \f3javadoc command accepts code containing generics and other language features introduced in JDK 1.5. The compiler defaults to the 1.5 behavior when the \f3-source option is not used.
0.2i Release Value: 1.4. The \f3javadoc command accepts code containing assertions, which were introduced in JDK 1.4.
0.2i Release Value: 1.3. The \f3javadoc command does not support assertions, generics, or other language features introduced after JDK 1.3.
-sourcepath sourcepathlist
Specifies the search paths for finding source files when passing package names or the \f3-subpackages option into the \f3javadoc command. Separate multiple paths with a colon (:). The \f3javadoc command searches 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. You can use the \f3-sourcepath option only when passing package names into the \f3javadoc command. This will not locate source files passed into the \f3javadoc command. To locate source files, \f3change to that directory or include the path ahead of each file, as shown at Document One or More Classes. If you omit \f3-sourcepath, then the \f3javadoc command uses the class path to find the source files (see \f3-classpath). The default \f3-sourcepath is the value of class path. If \f3-classpath is omitted and you pass package names into the \f3javadoc command, then the \f3javadoc command searches in the current directory and subdirectories for the source files. Set \f3sourcepathlist to the root directory of the source tree for the package you are documenting. For example, suppose you want to document a package called \f3com.mypackage, whose source files are located at:/home/user/src/com/mypackage/*.java. Specify the sourcepath to /home/user/src, the directory that contains com\emypackage, and then supply the package name, as follows:
\f3javadoc -sourcepath /home/user/src/ com.mypackage
\f3Notice that if you concatenate the value of sourcepath and the package name together and change the dot to a slash (/), then you have the full path to the package: /home/user/src/com/mypackage To point to two source paths:
\f3javadoc -sourcepath /home/user1/src:/home/user2/src com.mypackage
\f3
-classpath classpathlist
Specifies the paths where the \f3javadoc command searches for referenced classes These are the documented classes plus any classes referenced by those classes. Separate multiple paths with a colon (:). The \f3javadoc command searches all subdirectories of the specified paths. Follow the instructions in the class path documentation for specifying the \f3classpathlist value. If you omit \f3-sourcepath, then the \f3javadoc command uses \f3-classpath to find the source files and class files (for backward compatibility). If you want to search for source and class files in separate paths, then use both \f3-sourcepath and \f3-classpath. For example, if you want to document \f3com.mypackage, whose source files reside in the directory /home/user/src/com/mypackage, and if this package relies on a library in /home/user/lib, then you would use the following command:
\f3javadoc -sourcepath /home/user/lib -classpath /home/user/src com.mypackage
\f3Similar to other tools, if you do not specify \f3-classpath, then the \f3javadoc command uses the \f3CLASSPATH environment variable when it is set. If both are not set, then the \f3javadoc command searches for classes from the current directory. For an in-depth description of how the \f3javadoc command uses \f3-classpath to find user classes as it relates to extension classes and bootstrap classes, see How Classes Are Found at http://docs.oracle.com/javase/8/docs/technotes/tools/findingclasses.html A class path element that contains a base name of * is considered equivalent to specifying a list of all the files in the directory with the extension \f3.jar or \f3.JAR. For example, if directory \f3mydir contains \f3a.jar and \f3b.JAR, then the class path element \f3foo/* is expanded to a \f3A.jar:b.JAR, except that the order of JAR files is unspecified. All JAR files in the specified directory including hidden files are included in the list. A class path entry that consists of * expands to a list of all the jar files in the current directory. The \f3CLASSPATH environment variable is similarly expanded. Any class path wildcard expansion occurs before the Java Virtual Machine (JVM) starts. No Java program ever sees unexpanded wild cards except by querying the environment, for example, by calling System.getenv(\f3"CLASSPATH").
-subpackages package1:package2:...
Generates 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 because they are automatically included. Each package argument is any top-level subpackage (such as \f3java) or fully qualified package (such as \f3javax.swing) that does not need to contain source files. Arguments are separated by colons on all operating systems. Wild cards are not allowed. Use \f3-sourcepath to specify where to find the packages. This option does not process source files that are in the source tree but do not belong to the packages. See Process Source Files. For example, the following command generates documentation for packages named \f3java and \f3javax.swing and all of their subpackages.
\f3javadoc -d docs -sourcepath /home/user/src -subpackages java:javax.swing
\f3
-exclude packagename1:packagename2:...
Unconditionally excludes the specified packages and their subpackages from the list formed by \f3-subpackages. It excludes those packages even when they would otherwise be included by some earlier or later \f3-subpackages option. The following example would include \f3java.io, \f3java.util, and \f3java.math (among others), but would exclude packages rooted at \f3java.net and \f3java.lang. Notice that this example excludes \f3java.lang.ref, which is a subpackage of \f3java.lang.
\f3javadoc -sourcepath /home/user/src -subpackages java -exclude
\f3 java.net:java.lang
\f3
-bootclasspath classpathlist
Specifies the paths where the boot classes reside. These are typically the Java platform classes. The \f3bootclasspath is part of the search path the \f3javadoc command uses to look up source and class files. For more information, see How Classes Are Found at http://docs.oracle.com/javase/8/docs/technotes/tools/findingclasses.html Separate directories in the \f3classpathlist parameters with semicolons (;) for Windows and colons (:) for Oracle Solaris.
-extdirs dirist
Specifies the directories where extension classes reside. These are any classes that use the Java Extension mechanism. The \f3extdirs option is part of the search path the \f3javadoc command uses to look up source and class files. See the \f3-classpath option for more information. Separate directories in \f3dirlist with semicolons (;) for Windows and colons (:) for Oracle Solaris.
-verbose
Provides more detailed messages while the \f3javadoc command runs. Without the \f3verbose 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 that specify the number of milliseconds to parse each Java source file.
-quiet
Shuts off messages so that only the warnings and errors appear to make them easier to view. It also suppresses the \f3version string.
-breakiterator
Uses the internationalized sentence boundary of \f3java.text.BreakIterator to determine the end of the first sentence in the main description of a package, class, or member for English. All other locales already use the \f3BreakIterator class, rather than an English language, locale-specific algorithm. The first sentence is copied to the package, class, or member summary and to the alphabetic index. From JDK 1.2 and later, the \f3BreakIterator class is used to determine the end of a sentence for all languages except for English. Therefore, the \f3-breakiterator option has no effect except for English from 1.2 and later. English has its own default algorithm:
0.2i English default sentence-break algorithm. Stops at a period followed by a space or an HTML block tag, such as \f3<P>.
0.2i Breakiterator sentence-break algorithm. Stops at a period, question mark, or exclamation point followed by a space when the next word starts with a capital letter. This is meant to handle most abbreviations (such as "The serial no. is valid", but will not handle "Mr. Smith"). The \f3-breakiterator option does not stop at HTML tags or sentences that begin with numbers or symbols. The algorithm stops at the last period in ../filename, even when embedded in an HTML tag.
-locale language_country_variant
Specifies the locale that the \f3javadoc command uses when it generates documentation. The argument is the name of the locale, as described in \f3j\f3ava.util.Locale documentation, such as \f3en_US (English, United States) or \f3en_US_WIN (Windows variant). Note: The \f3-locale option must be placed ahead (to the left) of any options provided by the standard doclet or any other doclet. Otherwise, the navigation bars appear in English. This is the only command-line option that depends on order. See Standard Doclet Options. Specifying a locale causes the \f3javadoc command to choose the resource files of that locale for messages such as strings in the navigation bar, headings for lists and tables, help file contents, comments in the stylesheet.css file, and so on. It also specifies the sorting order for lists sorted alphabetically, and the sentence separator to determine the end of the first sentence. The \f3-locale option does not determine the locale of the documentation comment text specified in the source files of the documented classes.
-encoding
Specifies the encoding name of the source files, such as \f3EUCJIS/SJIS. If this option is not specified, then the platform default converter is used. See also the\f3-docencoding name and \f3-charset name options.
-Jflag
Passes \f3flag directly to the Java Runtime Environment (JRE) that runs the \f3javadoc command. For example, if you must ensure that the system sets aside 32 MB of memory in which to process the generated documentation, then you would call the \f3-Xmx option as follows: \f3javadoc -J-Xmx32m -J-Xms32m com.mypackage. Be aware that \f3-Xms is optional because it only sets the size of initial memory, which is useful when you know the minimum amount of memory required. There is no space between the \f3J and the \f3flag. Use the \f3-version option to find out what version of the \f3javadoc command you are using. The version number of the standard doclet appears in its output stream. See Running the Javadoc Command.
\f3javadoc -J-version
\f3java version "1.7.0_09"
\f3Java(TM) SE Runtime Environment (build 1.7.0_09-b05)
\f3Java HotSpot(TM) 64-Bit Server VM (build 23.5-b02, mixed mode)
\f3
-javafx
Generates HTML documentation using the JavaFX extensions to the standard doclet. The generated documentation includes a Property Summary section in addition to the other summary sections generated by the standard Java doclet. The listed properties are linked to the sections for the getter and setter methods of each property. If there are no documentation comments written explicitly for getter and setter methods, the documentation comments from the property method are automatically copied to the generated documentation for these methods. This option also adds a new \f3@defaultValue tag that allows documenting the default value for a property. Example:
\f3javadoc -javafx MyClass.java -d testdir
-d directory
Specifies the destination directory where the \f3javadoc command saves the generated HTML files. If you omit the \f3-d option, then the files are saved to the current directory. The \f3directory value can be absolute or relative to the current working directory. As of Java SE 1.4, the destination directory is automatically created when the \f3javadoc command runs. For example, the following command generates the documentation for the package \f3com.mypackage and saves the results in the /user/doc/ directory: \f3javadoc -d\f3/user/doc/\f3com.mypackage.
-use
Includes one Use page for each documented class and package. The page describes what packages, classes, methods, constructors and fields use any API of the specified 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. For example, you can look at the Use page for the \f3String type. Because the \f3getName method in the \f3java.awt.Font class returns type \f3String, the \f3getName method uses \f3String and so the \f3getName method appears on the Use page for \f3String.This documents only uses of the API, not the implementation. When a method uses \f3String in its implementation, but does not take a string as an argument or return a string, that is not considered a use of \f3String.To access the generated Use page, go to the class or package and click the Use link in the navigation bar.
-version
Includes the @version text in the generated docs. This text is omitted by default. To find out what version of the \f3javadoc command you are using, use the \f3-J-version option.
-author
Includes the \f3@author text in the generated docs.
-splitindex
Splits the index file into multiple files, alphabetically, one file per letter, plus a file for any index entries that start with non-alphabetical symbols.
-windowtitle title
Specifies the title to be placed in the HTML \f3<title> tag. The text specified in the \f3title tag 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 because the browser does not interpret them correctly. Use escape characters on any internal quotation marks within the \f3title tag. If the \f3-windowtitle option is omitted, then the \f3javadoc command uses the value of the \f3-doctitle option for the \f3-windowtitle option. For example, \f3javadoc -windowtitle "Java SE Platform" com.mypackage.
-doctitle title
Specifies the title to place near the top of the overview summary file. The text specified in the \f3title tag is placed as a centered, level-one heading directly beneath the top navigation bar. The \f3title tag can contain HTML tags and white space, but when it does, you must enclose the title in quotation marks. Internal quotation marks within the \f3title tag must be escaped. For example, \f3javadoc -header "<b>Java Platform </b><br>v1.4" com.mypackage.
-title title
No longer exists. It existed only in Beta releases of Javadoc 1.2. It was renamed to \f3-doctitle. This option was renamed to make it clear that it defines the document title, rather than the window title.
-header header
Specifies the header text to be placed at the top of each output file. The header is placed to the right of the upper navigation bar. The \f3header can contain HTML tags and white space, but when it does, the \f3header must be enclosed in quotation marks. Use escape characters for internal quotation marks within a header. For example, \f3javadoc -header "<b>Java Platform </b><br>v1.4" com.mypackage.
-footer footer
Specifies the footer text to be placed at the bottom of each output file. The footer value is placed to the right of the lower navigation bar. The \f3footer value can contain HTML tags and white space, but when it does, the \f3footer value must be enclosed in quotation marks. Use escape characters for any internal quotation marks within a footer.
-top
Specifies the text to be placed at the top of each output file.
-bottom text
Specifies the text to be placed at the bottom of each output file. The text is placed at the bottom of the page, underneath the lower navigation bar. The text can contain HTML tags and white space, but when it does, the text must be enclosed in quotation marks. Use escape characters for any internal quotation marks within text.
-link extdocURL
Creates links to existing Javadoc-generated documentation of externally referenced classes. The extdocURL argument is the absolute or relative URL of the directory that contains the external Javadoc-generated documentation you want to link to. You can specify multiple \f3-link options in a specified \f3javadoc command run to link to multiple documents. The package-list file must be found in this directory (otherwise, use the \f3-linkoffline option). The \f3javadoc command reads the package names from the package-list file and links to those packages at that URL. When the \f3javadoc command runs, the \f3extdocURL value is copied into the \f3<A HREF> links that are created. Therefore, \f3extdocURL must be the URL to the directory, and not to a file. You can use an absolute link for extdocURL to enable your documents to link to a document on any web site, or you can use a relative link to link only to a relative location. If you use a relative link, then the value you pass in should be the relative path from the destination directory (specified with the \f3-d option) to the directory containing the packages being linked to.When you specify an absolute link, you usually use an HTTP link. However, if you want to link to a file system that has no web server, then you can use a file link. Use a file link only when everyone who wants to access the generated documentation shares the same file system.In all cases, and on all operating systems, use a slash as the separator, whether the URL is absolute or relative, and \f3h\f3ttp: or \f3f\f3ile: as specified in the URL Memo: Uniform Resource Locators at http://www.ietf.org/rfc/rfc1738.txt
\f3-link http://<host>/<directory>/<directory>/.../<name>
\f3-link file://<host>/<directory>/<directory>/.../<name>
\f3-link <directory>/<directory>/.../<name>
\f3
Differences between the -linkoffline and -link options Use the \f3-link option in the following cases:
0.2i When you use a relative path to the external API document.
0.2i When you use an absolute URL to the external API document if your shell lets you open a connection to that URL for reading.
Use the \f3-linkoffline option when you use an absolute URL to the external API document, if your shell does not allow a program to open a connection to that URL for reading. This can occur when you are behind a firewall and the document you want to link to is on the other side.
\f3Example 1 Absolute Link to External Documents
Use the following command if you want to link to the \f3java.lang, \f3java.io and other Java platform packages, shown at http://docs.oracle.com/javase/8/docs/api/index.html
\f3javadoc -link http://docs.oracle.com/javase/8/docs/api/ com.mypackage
\f3The command generates documentation for the package \f3com.mypackage with links to the Java SE packages. The generated documentation contains links to the \f3Object class, for example, in the class \f3trees. Other options, such as the \f3-sourcepath and \f3-d options, are not shown.
\f3Example 2 Relative Link to External Documents
In this example, there are two packages with documents that are generated in different runs of the \f3javadoc command, and those documents are separated by a relative path. The packages are \f3com.apipackage, an API, and c\f3om.spipackage, an Service Provide Interface (SPI). You want the documentation to reside in docs/api/com/apipackage and docs/spi/com/spipackage. Assuming that the API package documentation is already generated, and that docs is the current directory, you document the SPI package with links to the API documentation by running: \f3javadoc -d ./spi -link ../api com.spipackage.
Notice the \f3-link option is relative to the destination directory (docs/spi).
Notes The \f3-link option lets you link to classes referenced to by your code, but not documented in the current \f3javadoc command run. For these links to go to valid pages, you must know where those HTML pages are located and specify that location with \f3extdocURL. This allows third-party documentation to link to java.* documentation at http://docs.oracle.com.Omit the \f3-link option when you want the \f3javadoc command to create links only to APIs within the documentation it is generating in the current run. Without the \f3-link option, the \f3javadoc command does not create links to documentation for external references because it does not know whether or where that documentation exists.The \f3-link option can create links in several places in the generated documentation. See Process Source Files. Another use is for cross-links between sets of packages: Execute the \f3javadoc command on one set of packages, then run the \f3javadoc command again on another set of packages, creating links both ways between both sets.
How to Reference a Class For a link to an externally referenced class to 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 \f3import statement or in a declaration. Here are examples of how the class \f3java.io.File can be referenced:
In any kind of import statement. By wildcard import, import explicitly by name, or automatically import for \f3java.lang.*.
In Java SE 1.3.n and 1.2.n, only an explicit import by name works. A wildcard \f3import statement does not work, nor does the automatic \f3import java.lang.*.
In a declaration: \f3void mymethod(File f) {}
The reference can be in the return type or parameter type of a method, constructor, field, class, or interface, or in an implements, extends, or throws statement.
An important corollary is that when you use the \f3-link option, there can be many links that unintentionally do not appear due to this constraint. The text would appear without being a link. You can detect these by the warnings they emit. The simplest way to properly reference a class and add the link would be to import that class.
Package List The \f3-link option requires that a file named package-list, which is generated by the \f3javadoc command, exists at the URL you specify with the \f3-link option. The package-list file is a simple text file that lists the names of packages documented at that location. In the earlier example, the \f3javadoc command searches for a file named package-list at the specified URL, reads in the package names, and links to those packages at that URL.
For example, the package list for the Java SE API is located at http://docs.oracle.com/javase/8/docs/api/package-list
The package list starts as follows:
\f3java.applet
\f3java.awt
\f3java.awt.color
\f3java.awt.datatransfer
\f3java.awt.dnd
\f3java.awt.event
\f3java.awt.font
\f3and so on ....
\f3When \f3javadoc is run without the \f3-link option and encounters a name that belongs to an externally referenced class, it prints the name with no link. However, when the \f3-link option is used, the \f3javadoc command searches the package-list file at the specified extdocURL location for that package name. When it finds the package name, it prefixes the name with extdocURL.
For there to be no broken links, all of the documentation for the external references must exist at the specified URLs. The \f3javadoc command does not check that these pages exist, but only that the package-list exists.
Multiple Links You can supply multiple \f3-link options to link to any number of externally generated documents. Javadoc 1.2 has a known bug that prevents you from supplying more than one \f3-link options. This was fixed in Javadoc 1.2.2. Specify a different link option for each external document to link to \f3javadoc -link extdocURL1 -link extdocURL2 ... -link extdocURLn com.mypackage where extdocURL1, extdocURL2, .\f3.. extdocURLn point respectively to the roots of external documents, each of which contains a file named package-list.
Cross Links Note that bootstrapping might be required when cross-linking two or more documents that were previously generated. If package-list does not exist for either document when you run the \f3javadoc command on the first document, then the package-list does not yet exist for the second document. Therefore, to create the external links, you must regenerate the first document after you generate the second document.
In this case, the purpose of first generating a document is to create its package-list (or you can create it by hand if you are certain of the package names). Then, generate the second document with its external links. The \f3javadoc command prints a warning when a needed external package-list file does not exist.
-linkoffline extdocURL packagelistLoc
This option is a variation of the \f3-link option. They both create links to Javadoc-generated documentation for externally referenced classes. Use the \f3-linko\f3ffline option when linking to a document on the web when the \f3javadoc command cannot access the document through a web connection. Use the \f3-linkoffline option when package-list file of the external document is not accessible or does not exist at the \f3extdocURL location, but does exist at a different location that can be specified by \f3packageListLoc (typically local). If \f3extdocURL is accessible only on the World Wide Web, then the \f3-linkoffline option removes the constraint that the \f3javadoc command must have a web connection to generate documentation. Another use is as a work-around to update documents: After you have run the \f3javadoc command on a full set of packages, you can run the \f3javadoc command again on a smaller set of changed packages, so that the updated files can be inserted back into the original set. Examples follow. The \f3-linkoffline option takes two arguments. The first is for the string to be embedded in the \f3<a href> links, and the second tells the \f3-linkoffline option where to find package-list:
0.2i The \f3extdocURL value is the absolute or relative URL of the directory that contains the external Javadoc-generated documentation you want to link to. When relative, the value should be the relative path from the destination directory (specified with the \f3-d option) to the root of the packages being linked to. For more information, see extdocURL in the \f3-link option.
0.2i The \f3packagelistLoc value is the path or URL to the directory that contains the package-list file for the external documentation. This can be a URL (http: or file:) or file path, and can be absolute or relative. When relative, make it relative to the current directory from where the \f3javadoc command was run. Do not include the package-list file name. You can specify multiple \f3-linkoffline options in a specified \f3javadoc command run. Before Javadoc 1.2.2, the \f3-linkfile options could be specified once.
Absolute Links to External Documents You might have a situation where you want to link to the \f3java.lang, \f3java.io and other Java SE packages at http://docs.oracle.com/javase/8/docs/api/index.html
However, your shell does not have web access. In this case, do the following:
0.4i 1. Open the package-list file in a browser at http://docs.oracle.com/javase/8/docs/api/package-list
0.4i 2. Save the file to a local directory, and point to this local copy with the second argument, \f3packagelistLoc. In this example, the package list file was saved to the current directory (.).
The following command generates documentation for the package c\f3om.mypackage with links to the Java SE packages. The generated documentation will contain links to the \f3Object class, for example, in the class \f3trees. Other necessary options, such as \f3-sourcepath, are not shown.
\f3javadoc -linkoffline http://docs.oracle.com/javase/8/docs/api/ . com.mypackage
\f3
Relative Links to External Documents It is not very common to use \f3-linkoffline with relative paths, for the simple reason that the \f3-link option is usually enough. When you use the \f3-linkoffline option, the package-list file is usually local, and when you use relative links, the file you are linking to is also local, so it is usually unnecessary to give a different path for the two arguments to the \f3-linkoffline option When the two arguments are identical, you can use the \f3-link option.
Create a package-list File Manually If a package-list file does not exist yet, but you know what package names your document will link to, then you can manually create your own copy of this file and specify its path with \f3packagelistLoc. An example would be the previous case where the package list for \f3com.spipackage did not exist when \f3com.apipackage 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 package-list files for packages generated with Javadoc 1.0 or 1.1, where package-list files were not generated. Similarly, two companies can share their unpublished package-list files so they can release their cross-linked documentation simultaneously.
Link to Multiple Documents You can include the \f3-linkoffline option once for each generated document you want to refer to:
\f3javadoc -linkoffline extdocURL1 packagelistLoc1 -linkoffline extdocURL2
\f3packagelistLoc2 ...
\f3
Update Documents You can also use the \f3-linkoffline option when your project has dozens or hundreds of packages. If you have already run the \f3javadoc command on the entire source tree, then you can quickly make small changes to documentation comments and rerun the \f3javadoc command on a portion of the source tree. Be aware that the second run works properly only when your changes are to documentation 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.
First, create a new destination directory, such as update, for this new small run. In this example, the original destination directory is named html. In the simplest example, change directory to the parent of html. Set the first argument of the \f3-linkoffline option to the current directory (.) and set the second argument to the relative path to html, where it can find package-list and pass in only the package names of the packages you want to update:
\f3javadoc -d update -linkoffline . html com.mypackage
\f3When the \f3javadoc command completes, copy these generated class pages in update/com/package (not the overview or index) to the original files in html/com/package.
-linksource
Creates 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. This option exposes all private implementation details in the included source files, including private classes, private fields, and the bodies of private methods, regardless of the \f3-public, \f3-package, \f3-protected, and \f3-private options. Unless you also use the \f3-private option, not all private classes or interfaces are accessible through links. Each link appears on the name of the identifier in its declaration. For example, the link to the source code of the \f3Button class would be on the word \f3Button:
\f3public class Button extends Component implements Accessible
\f3The link to the source code of the \f3getLabel method in the \f3Button class is on the word \f3getLabel:
\f3public String getLabel()
\f3
-group groupheading packagepattern:packagepattern
Separates packages on the overview page into whatever groups you specify, one group per table. You specify each group with a different \f3-group option. The groups appear on the page in the order specified on the command line. Packages are alphabetized within a group. For a specified \f3-group option, the packages matching the list of \f3packagepattern expressions appear in a table with the heading groupheading.
0.2i The \f3groupheading can be any text and can include white space. This text is placed in the table heading for the group.
0.2i The \f3packagepattern value can be any package name at the start of any package name followed by an asterisk (*). The asterisk is the only wildcard allowed and means match any characters. Multiple patterns can be included in a group by separating them with colons (:). If you use an asterisk in a pattern or pattern list, then the pattern list must be inside quotation marks, such as \f3"java.lang*:java.util".
\f3javadoc -group "Core Packages" "java.lang*:java.util"
\f3 -group "Extension Packages" "javax.*"
\f3 java.lang java.lang.reflect java.util javax.servlet java.new
\f3Core Packages \f3java.lang \f3java.lang.reflect \f3java.util Extension Packages \f3javax.servlet Other Packages \f3java.new
-nodeprecated
Prevents the generation of any deprecated API in the documentation. This does what the \f3-nodeprecatedlist option does, and it does not generate any deprecated API throughout the rest of the documentation. This is useful when writing code when you do not want to be distracted by the deprecated code.
-nodeprecatedlist
Prevents the generation of the file that contains the list of deprecated APIs (deprecated-list.html) and the link in the navigation bar to that page. The \f3javadoc command continues to generate the deprecated API throughout the rest of the document. This is useful when your source code contains no deprecated APIs, and you want to make the navigation bar cleaner.
-nosince
Omits from the generated documents the \f3Since sections associated with the \f3@since tags.
-notree
Omits the class/interface hierarchy pages from the generated documents. These are the pages you reach using the Tree button in the navigation bar. The hierarchy is produced by default.
-noindex
Omits the index from the generated documents. The index is produced by default.
-nohelp
Omits the HELP link in the navigation bars at the top and bottom of each page of output.
-nonavbar
Prevents the generation of the navigation bar, header, and footer, that are usually found at the top and bottom of the generated pages. The \f3-nonavbar option has no affect on the \f3-bottom option. The \f3-nonavbar option is useful when you are interested only in the content and have no need for navigation, such as when you are converting the files to PostScript or PDF for printing only.
-helpfile path\efilename
Specifies the path of an alternate help file path\efilename that the HELP link in the top and bottom navigation bars link to. Without this option, the \f3javadoc command creates a help file help-doc.html that is hard-coded in the \f3javadoc command. This option lets you override the default. The file name can be any name and is not restricted to help-doc.html. The \f3javadoc command adjusts the links in the navigation bar accordingly, for example:
\f3javadoc -helpfile /home/user/myhelp.html java.awt.
\f3
Specifies the path of an alternate HTML stylesheet file. Without this option, the \f3javadoc command automatically creates a stylesheet file stylesheet.css that is hard-coded in the \f3javadoc command. This option lets you override the default. The file name can be any name and is not restricted to stylesheet.css, for example:
\f3javadoc -stylesheet file /home/user/mystylesheet.css com.mypackage
\f3
-serialwarn
Generates compile-time warnings for missing \f3@serial tags. By default, Javadoc 1.2.2 and later versions generate no serial warnings. This is a reversal from earlier releases. Use this option to display the serial warnings, which helps to properly document default serializable fields and \f3writeExternal methods.
-charset name
Specifies the HTML character set for this document. The name should be a preferred MIME name as specified in the IANA Registry, Character Sets at http://www.iana.org/assignments/character-sets For example, \f3javadoc -charset "iso-8859-1" mypackage inserts the following line in the head of every generated page:
\f3<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
\f3This \f3META tag is described in the HTML standard (4197265 and 4137321), HTML Document Representation, at http://www.w3.org/TR/REC-html40/charset.html#h-5.2.2 See also the \f3-encoding and \f3-docencoding name options.
-docencoding name
Specifies the encoding of the generated HTML files. The name should be a preferred MIME name as specified in the IANA Registry, Character Sets at http://www.iana.org/assignments/character-sets If you omit the \f3-docencoding option but use the \f3-encoding option, then the encoding of the generated HTML files is determined by the \f3-encoding option, for example: \f3javadoc -docencoding "iso-8859-1" mypackage. See also the \f3-encoding and \f3-docencoding name options.
-keywords
Adds HTML keyword <META> tags to the generated file for each class. These tags can help search engines that look for <META> tags find the pages. Most search engines that search the entire Internet do not look at <META> tags, because pages can misuse them. Search engines offered by companies that confine their searches to their own website can benefit by looking at <META> tags. The <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 \f3String starts with these keywords:
\f3<META NAME="keywords" CONTENT="java.lang.String class">
\f3<META NAME="keywords" CONTENT="CASE_INSENSITIVE_ORDER">
\f3<META NAME="keywords" CONTENT="length()">
\f3<META NAME="keywords" CONTENT="charAt()">
\f3
-tag tagname:Xaoptcmf:"taghead"
Enables the \f3javadoc command to interpret a simple, one-argument \f3@tagname custom block tag in documentation comments. For the \f3javadoc command to spell-check tag names, it is important to include a \f3-tag option for every custom tag that is present in the source code, disabling (with \f3X) those that are not being output in the current run.The colon (:) is always the separator. The \f3-tag option outputs the tag heading taghead in bold, followed on the next line by the text from its single argument. Similar to any block tag, the argument text can contain inline tags, which are also interpreted. The output is similar to standard one-argument tags, such as the \f3@return and \f3@author tags. Omitting a value for taghead causes \f3tagname to be the heading. Placement of tags: The \f3Xaoptcmf arguments determine where in the source code the tag is allowed to be placed, and whether the tag can be disabled (using \f3X). You can supply either \f3a, to allow the tag in all places, or any combination of the other letters: \f3X (disable tag) \f3a (all) \f3o (overview) \f3p (packages) \f3t (types, that is classes and interfaces) \f3c (constructors) \f3m (methods) \f3f (fields) Examples of single tags: An example of a tag option for a tag that can be used anywhere in the source code is: \f3-tag todo:a:"To Do:". If you want the \f3@todo tag to be used only with constructors, methods, and fields, then you use: \f3-tag todo:cmf:"To Do:". Notice the last colon (:) is not a parameter separator, but is part of the heading text. You would use either tag option for source code that contains the \f3@todo tag, such as: \f3@todo The documentation for this method needs work. Colons in tag names: Use a backslash to escape a colon that you want to use in a tag name. Use the \f3-tag ejb\e\e:bean:a:"EJB Bean:" option for the following documentation comment:
\f3/**
\f3 * @ejb:bean
\f3 */
\f3Spell-checking tag names: Some developers put custom tags in the source code that they do not always want to output. In these cases, it is important to list all tags that are in the source code, enabling the ones you want to output and disabling the ones you do not want to output. The presence of \f3X disables the tag, while its absence enables the tag. This gives the \f3javadoc command enough information to know whether a tag it encounters is unknown, which is probably the results of a typographical error or a misspelling. The \f3javadoc command prints a warning in these cases. You can add \f3X to the placement values already present, so that when you want to enable the tag, you can simply delete the \f3X. For example, if the \f3@todo tag is a tag that you want to suppress on output, then you would use: \f3-tag todo:Xcmf:"To Do:". If you would rather keep it simple, then use this: \f3-tag todo:X. The syntax \f3-tag todo:X works even when the \f3@todo tag is defined by a taglet. Order of tags: The order of the \f3-ta\f3g and \f3-taglet options determines 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.If the \f3-tag option is missing, then the position of the \f3-tagle\f3t option 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 the \f3-taglet and \f3-tag options have the name \f3todo value, then the one that appears last on the command line determines the order. Example of a complete set of tags: This example inserts To Do after Parameters and before Throws in the output. By using \f3X, it also specifies that the \f3@example tag might be encountered in the source code that should not be output during this run. If you use the \f3@argfile tag, then you can put the tags on separate lines in an argument file similar to this (no line continuation characters needed):
\f3-tag param
\f3-tag return
\f3-tag todo:a:"To Do:"
\f3-tag throws
\f3-tag see
\f3-tag example:X
\f3When the \f3javadoc command parses the documentation comments, any tag encountered that is neither a standard tag nor passed in with the \f3-tag or \f3-taglet options is considered unknown, and a warning is thrown. The standard tags are initially stored internally in a list in their default order. Whenever the \f3-tag options are used, those tags get appended to this list. Standard tags are moved from their default position. Therefore, if a \f3-tag option is omitted for a standard tag, then it remains in its default position. Avoiding conflicts: If you want to create your own namespace, then you can use a dot-separated naming convention similar to that used for packages: \f3com.mycompany.todo. Oracle 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 Oracle. If you create a \f3@todo tag or taglet, then it always has the same behavior you define, even when Oracle later creates a standard tag of the same name. Annotations vs. Javadoc tags: In general, if the markup you want to add is intended to affect or produce documentation, then it should be a Javadoc tag. Otherwise, it should be an annotation. See Custom Tags and Annotations in How to Write Doc Comments for the Javadoc Tool at http://www.oracle.com/technetwork/java/javase/documentation/index-137868.html#annotations You can also create more complex block tags or custom inline tags with the \f3-taglet option.
-taglet class
Specifies the class file that starts the taglet used in generating the documentation for that tag. Use the fully qualified name for the \f3class value. 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: Taglet Overview at http://docs.oracle.com/javase/8/docs/technotes/guides/javadoc/taglet/overview.html Taglets 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. Taglets can only determine where a tag should appear and in what form. All other decisions are made by the doclet. 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. Use the \f3-tagletpath option to specify the path to the taglet. The following example inserts the To Do taglet after Parameters and ahead of Throws in the generated pages. Alternately, you can use the \f3-taglet option in place of its \f3-tag option, but that might be difficult to read.
\f3-taglet com.sun.tools.doclets.ToDoTaglet
\f3-tagletpath /home/taglets
\f3-tag return
\f3-tag param
\f3-tag todo
\f3-tag throws
\f3-tag see
\f3
-tagletpath tagletpathlist
Specifies the search paths for finding taglet class files. The \f3tagletpathlist can contain multiple paths by separating them with a colon (:). The \f3javadoc command searches all subdirectories of the specified paths.
-docfilesubdirs
Enables deep copying of doc-files directories. Subdirectories and all contents are recursively copied to the destination. For example, the directory doc-files/example/images and all of its contents would be copied. There is also an option to exclude subdirectories.
-excludedocfilessubdir name1:name2
Excludes any doc-files subdirectories with the specified names. This prevents the copying of SCCS and other source-code-control subdirectories.
-noqualifier all | packagename1:packagename2...
Omits qualifying package names from class names in output. The argument to the \f3-noqualifier option is either \f3all (all package qualifiers are omitted) or a colon-separate list of packages, with wild cards, to be removed as qualifiers. The package name is removed from places where class or interface names appear. See Process Source Files. The following example omits all package qualifiers: \f3-noqualifier all. The following example omits \f3java.lang and \f3java.io package qualifiers: \f3-noqualifier java.lang:java.io. The following example omits package qualifiers starting with \f3java, and \f3com.sun subpackages, but not \f3javax: \f3-noqualifier java.*:com.sun.*. Where a package qualifier would appear due to the previous behavior, the name can be suitably shortened. See How a Name Appears. This rule is in effect whether or not the \f3-noqualifier option is used.
-notimestamp
Suppresses the time stamp, which is hidden in an HTML comment in the generated HTML near the top of each page. The \f3-notimestamp option is useful when you want to run the \f3javadoc command on two source bases and get the differences between \f3diff them, because it prevents time stamps from causing a \f3diff (which would otherwise be a \f3diff on every page). The time stamp includes the \f3javadoc command release number, and currently appears similar to this: \f3<!-- Generated by javadoc (build 1.5.0_01) on Thu Apr 02 14:04:52 IST 2009 -->.
-nocomment
Suppresses the entire comment body, including the main description and all tags, and generate only declarations. This option lets you reuse source files that were originally intended for a different purpose so that you can produce skeleton HTML documentation at the early stages of a new project.
-sourcetab tablength
Specifies the number of spaces each tab uses in the source.
An argument file can include \f3javac options and source file names in any combination. The arguments within a file can be space-separated or newline-separated. If a file name contains embedded spaces, then put the whole file name in double quotation marks.
File Names within an argument file are relative to the current directory, not the location of the argument file. Wild cards (\f3*) are not allowed in these lists (such as for specifying *.java). Using the at sign (@) to recursively interpret files is not supported. The \f3-J options are not supported because they are passed to the launcher, which does not support argument files.
When you run the \f3javadoc command, pass in the path and name of each argument file with the @ leading character. When the \f3javadoc command encounters an argument beginning with the at sign (@), it expands the contents of that file into the argument list.
\f3Example 1 Single Argument File
You could use a single argument file named \f3argfile to hold all \f3javadoc command arguments: \f3javadoc @argfile. The argument file \f3contains the contents of both files, as shown in the next example.
\f3Example 2 Two Argument Files
You can create two argument files: One for the \f3javadoc command options and the other for the package names or source file names. Notice the following lists have no line-continuation characters.
Create a file named options that contains:
\f3-d docs-filelist
\f3-use
\f3-splitindex
\f3-windowtitle 'Java SE 7 API Specification'
\f3-doctitle 'Java SE 7 API Specification'
\f3-header '<b>Java\(tm SE 7</b>'
\f3-bottom 'Copyright © 1993-2011 Oracle and/or its affiliates. All rights reserved.'
\f3-group "Core Packages" "java.*"
\f3-overview /java/pubs/ws/1.7.0/src/share/classes/overview-core.html
\f3-sourcepath /java/pubs/ws/1.7.0/src/share/classes
\f3Create a file named packages that contains:
\f3com.mypackage1
\f3com.mypackage2
\f3com.mypackage3
\f3Run the \f3javadoc command as follows:
\f3javadoc @options @packages
\f3\f3Example 3 Argument Files with Paths
The argument files can have paths, but any file names inside the files are relative to the current working directory (not \f3path1 or \f3path2):
\f3javadoc @path1/options @path2/packages
\f3\f3Example 4 Option Arguments
The following example saves an argument to a \f3javadoc command option in an argument file. The \f3-bottom option is used because it can have a lengthy argument. You could create a file named bottom to contain the text argument:
\f3<font size="-1">
\f3 <a href="http://bugreport.sun.com/bugreport/">Submit a bug or feature</a><br/>
\f3 Copyright © 1993, 2011, Oracle and/or its affiliates. All rights reserved. <br/>
\f3 Oracle is a registered trademark of Oracle Corporation and/or its affiliates.
\f3 Other names may be trademarks of their respective owners.</font>
\f3Run the \f3javadoc command as follows:\f3javadoc -bottom @bottom @packages.
You can also include the \f3-bottom option at the start of the argument file and run the \f3javadoc command as follows: \f3javadoc @bottom @packages.
Use the public programmatic interface to call the \f3javadoc command from within programs written in the Java language. This interface is in \f3com.sun.tools.javadoc.Main (and the \f3javadoc command is reentrant). For more information, see The Standard Doclet at http://docs.oracle.com/javase/8/docs/technotes/guides/javadoc/standard-doclet.html#runningprogrammatically
The following instructions call the standard HTML doclet. To call a custom doclet, use the \f3-doclet and \f3-docletpath options. See Doclet Overview at http://docs.oracle.com/javase/8/docs/technotes/guides/javadoc/doclet/overview.html
In the following examples, the source files are located at /home/src/java/awt/*.java. The destination directory is /home/html.
Document One or More Packages To document a package, the source files for that package must be located in a directory that has the same name as the package.
If a package name has several identifiers (separated by dots, such as \f3java.awt.color), then each subsequent identifier must correspond to a deeper subdirectory (such as java/awt/color).
You can split the source files for a single package among two such directory trees located at different places, as long as \f3-sourcepath points to them both. For example, src1/java/awt/color and src2/java/awt/color.
You can run the \f3javadoc command either by changing directories (with the \f3cd command) or by using the \f3-sourcepath option. The following examples illustrate both alternatives.
\f3Example 1 Recursive Run from One or More Packages
This example uses \f3-sourcepath so the \f3javadoc command can be run from any directory and \f3-subpackages (a new 1.4 option) for recursion. It traverses the subpackages of the java directory excluding packages rooted at \f3java.net and \f3java.lang. Notice this excludes \f3java.lang.ref, a subpackage of \f3java.lang. To also traverse down other package trees, append their names to the \f3-subpackages argument, such as \f3java:javax:org.xml.sax.
\f3javadoc -d /home/html -sourcepath /home/src -subpackages java -exclude
\f3\f3Example 2 Change to Root and Run Explicit Packages
Change to the parent directory of the fully qualified package. Then, run the \f3javadoc command with the names of one or more packages that you want to document:
\f3cd /home/src/
\f3javadoc -d /home/html java.awt java.awt.event
\f3To also traverse down other package trees, append their names to the \f3-subpackages argument, such as j\f3ava:javax:org.xml.sax.
\f3Example 3 Run from Any Directory on Explicit Packages in One Tree
In this case, it does not matter what the current directory is. Run the \f3javadoc command and use the \f3-sourcepath option with the parent directory of the top-level package. Provide the names of one or more packages that you want to document:
\f3javadoc -d /home/html -sourcepath /home/src java.awt java.awt.event
\f3\f3Example 4 Run from Any Directory on Explicit Packages in Multiple Trees
Run the \f3javadoc command and use the \f3-sourcepath option with a colon-separated list of the paths to each tree's root. Provide the names of one or more packages that you want to document. All source files for a specified package do not need to be located under a single root directory, but they must be found somewhere along the source path.
\f3javadoc -d /home/html -sourcepath /home/src1:/home/src2 java.awt java.awt.event
\f3The result is that all cases generate HTML-formatted documentation for the \f3public and \f3protected classes and interfaces in packages j\f3ava.awt and \f3java.awt.event and save the HTML files in the specified destination directory. Because two or more packages are being generated, the document has three HTML frames: one for the list of packages, another for the list of classes, and the third for the main class pages.
Document One or More Classes The second way to run the \f3javadoc command is to pass one or more source files. You can run \f3javadoc either of the following two ways: by changing directories (with the \f3cd command) or by fully specifying the path to the source files. Relative paths are relative to the current directory. The \f3-sourcepath option is ignored when passing source files. You can use command-line wild cards, such as an asterisk (*), to specify groups of classes.
\f3Example 1 Change to the Source Directory
Change to the directory that holds the source files. Then run the \f3javadoc command with the names of one or more source files you want to document.
This example generates HTML-formatted documentation for the classes \f3Button, \f3Canvas, and classes that begin with \f3Graphics. Because source files rather than package names were passed in as arguments to the \f3javadoc command, the document has two frames: one for the list of classes and the other for the main page.
\f3cd /home/src/java/awt
\f3javadoc -d /home/html Button.java Canvas.java Graphics*.java
\f3\f3Example 2 Change to the Root Directory of the Package
This is useful for documenting individual source files from different subpackages off of the same root. Change to the package root directory, and supply the source files with paths from the root.
\f3cd /home/src/
\f3javadoc -d /home/html java/awt/Button.java java/applet/Applet.java
\f3\f3Example 3 Document Files from Any Directory
In this case, it does not matter what the current directory is. Run the \f3javadoc command with the absolute path (or path relative to the current directory) to the source files you want to document.
\f3javadoc -d /home/html /home/src/java/awt/Button.java
\f3/home/src/java/awt/Graphics*.java
\f3
Document Packages and Classes You can document entire packages and individual classes at the same time. Here is an example that mixes two of the previous examples. You can use the \f3-sourcepath option for the path to the packages but not for the path to the individual classes.
\f3javadoc -d /home/html -sourcepath /home/src java.awt
\f3/home/src/java/applet/Applet.java
\f3
Command-Line Example The following command might be too long for some shells. You can use a command-line argument file (or write a shell script) to overcome this limitation.
In the example, \f3packages is the name of a file that contains the packages to process, such as \f3java.applet\f3java.lang. None of the options should contain any newline characters between the single quotation marks. For example, if you copy and paste this example, then delete the newline characters from the \f3-bottom option.
\f3javadoc -sourcepath /java/jdk/src/share/classes \e
\f3-overview /java/jdk/src/share/classes/overview.html \e
\f3-d /java/jdk/build/api \e
\f3-use \e
\f3-splitIndex \e
\f3-windowtitle 'Java Platform, Standard Edition 7 API Specification' \e
\f3-doctitle 'Java Platform, Standard Edition 7 API Specification' \e
\f3-header '<b>Java\(tm SE 7</b>' \e
\f3-bottom '<font size="-1">
\f3<a href="http://bugreport.sun.com/bugreport/">Submit a bug or feature</a><br/>
\f3Copyright © 1993, 2011, Oracle and/or its affiliates. All rights reserved.<br/>
\f3Oracle is a registered trademark of Oracle Corporation and/or its affiliates.
\f3Other names may be trademarks of their respective owners.</font>' \e
\f3-group "Core Packages" "java.*:com.sun.java.*:org.omg.*" \e
\f3-group "Extension Packages" "javax.*" \e
\f3-J-Xmx180m \e
\f3@packages
\f3
Programmatic Interface The Javadoc Access API enables the user to invoke the Javadoc tool directly from a Java application without executing a new process.
For example, the following statements are equivalent to the command \f3javadoc -d /home/html -sourcepath /home/src -subpackages java -exclude java.net:java.lang com.example:
\f3import javax.tools.DocumentationTool;
\f3import javax.tools.ToolProvider;
\f3
\f3public class JavaAccessSample{
\f3 public static void main(String[] args){
\f3 DocumentationTool javadoc = ToolProvider.getSystemDocumentationTool();
\f3 int rc = javadoc.run( null, null, null,
\f3 "-d", "/home/html",
\f3 "-sourcepath", "home/src",
\f3 "-subpackages", "java",
\f3 "-exclude", "java.net:java.lang",
\f3 "com.example");
\f3 }
\f3 }
\f3The first three arguments of the \f3run method specify input, standard output, and standard error streams. \f3Null is the default value for \f3System.in, \f3System.out, and \f3System.err, respectively.
\f3javadoc -sourcepath $(SRCDIR) \e /* Sets path for source files */
\f3 -overview $(SRCDIR)/overview.html \e /* Sets file for overview text */
\f3 -d /java/jdk/build/api \e /* Sets destination directory */
\f3 -use \e /* Adds "Use" files */
\f3 -splitIndex \e /* Splits index A-Z */
\f3 -windowtitle $(WINDOWTITLE) \e /* Adds a window title */
\f3 -doctitle $(DOCTITLE) \e /* Adds a doc title */
\f3 -header $(HEADER) \e /* Adds running header text */
\f3 -bottom $(BOTTOM) \e /* Adds text at bottom */
\f3 -group $(GROUPCORE) \e /* 1st subhead on overview page */
\f3 -group $(GROUPEXT) \e /* 2nd subhead on overview page */
\f3 -J-Xmx180m \e /* Sets memory to 180MB */
\f3 java.lang java.lang.reflect \e /* Sets packages to document */
\f3 java.util java.io java.net \e
\f3 java.applet
\f3
\f3WINDOWTITLE = 'Java\(tm SE 7 API Specification'
\f3DOCTITLE = 'Java\(tm Platform Standard Edition 7 API Specification'
\f3HEADER = '<b>Java\(tm SE 7</font>'
\f3BOTTOM = '<font size="-1">
\f3 <a href="http://bugreport.sun.com/bugreport/">Submit a bug or feature</a><br/>
\f3 Copyright © 1993, 2011, Oracle and/or its affiliates. All rights reserved.<br/>
\f3 Oracle is a registered trademark of Oracle Corporation and/or its affiliates.
\f3 Other names may be trademarks of their respective owners.</font>'
\f3GROUPCORE = '"Core Packages" "java.*:com.sun.java.*:org.omg.*"'
\f3GROUPEXT = '"Extension Packages" "javax.*"'
\f3SRCDIR = '/java/jdk/1.7.0/src/share/classes'
\f3
0.2i If you omit the \f3-windowtitle option, then the \f3javadoc command copies the document title to the window title. The \f3-windowtitle option text is similar to the the \f3-doctitle option, but without HTML tags to prevent those tags from appearing as raw text in the window title.
0.2i If you omit the \f3-footer option, then the \f3javadoc command copies the header text to the footer.
0.2i Other important options you might want to use, but were not needed in the previous example, are the \f3-classpath and \f3-link options.
0.2i The \f3javadoc command reads only files that contain valid class names. If the \f3javadoc command is not correctly reading the contents of a file, then verify that the class names are valid. See Process Source Files.
0.2i See the Javadoc FAQ for information about common bugs and for troubleshooting tips at http://www.oracle.com/technetwork/java/javase/documentation/index-137483.html
For example, this message \f3error: cannot read: Class1.java means that the \f3javadoc command is trying to load \f3Class1.jav\f3a in the current directory. The class name is shown with its path (absolute or relative).
CLASSPATH \f3CLASSPATH is the environment variable that provides the path that the \f3javadoc command uses to find user class files. This environment variable is overridden by the \f3-classpath option. Separate directories with a semicolon for Windows or a colon for Oracle Solaris. Windows example: \f3.;C:\eclasses;C:\ehome\ejava\eclasses Oracle Solaris example: \f3.:/home/classes:/usr/local/java/classes.
0.2i javac(1)
0.2i java(1)
0.2i jdb(1)
0.2i javah(1)
0.2i javap(1)
0.2i Javadoc Technology at http://docs.oracle.com/javase/8/docs/technotes/guides/javadoc/index.html
0.2i How Classes Are Found http://docs.oracle.com/javase/8/docs/technotes/tools/findingclasses.html
0.2i How to Write Doc Comments for the Javadoc Tool http://www.oracle.com/technetwork/java/javase/documentation/index-137868.html
0.2i URL Memo, Uniform Resource Locators http://www.ietf.org/rfc/rfc1738.txt
0.2i HTML standard, HTML Document Representation (4197265 and 4137321) http://www.w3.org/TR/REC-html40/charset.html#h-5.2.2
'pl 8.5i 'bp