JAVADOC(1)
π JAVADOC(1) β JDK Commands π
β¨ NAME β¨
javadoc β generate HTML pages of API documentation from Java source files π«Ά
π SYNOPSIS π
javadoc [options] [packagenames] [sourcefiles] [@files]
optionsβ Specifies command-line options, separated by spaces. See Standard javadoc Options, Extra javadoc Options, Standard Options for the Standard Doclet, and Extra Options for the Standard Doclet. πpackagenamesβ Specifies names of packages that you want to document, separated by spaces, for examplejava.lang java.lang.reflect java.awt. If you want to also document the subpackages, then use the-subpackagesoption to specify the packages. By default,javadoclooks for the specified packages in the current directory and subdirectories. Use the-sourcepathoption to specify the list of directories where to look for packages. πsourcefilesβ Specifies names of Java source files that you want to document, separated by spaces, for exampleClass.java Object.java Button.java. By default,javadoclooks 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/home/src/java/awt/Graphics*.java. You can also specify the path relative to the current directory. π¦@filesβ Specifies names of files that contain a list ofjavadoctool options, package names, and source file names in any order. β¨
πΈ DESCRIPTION πΈ
The javadoc tool parses the declarations and documentation comments in a set of Java source files and processes them using a pluggable back-end called a doclet. π
The standard doclet is the one that is used by default, and can produce corresponding HTML pages that describe the public and protected classes, nested and implicitly declared classes (but not anonymous inner classes), interfaces, constructors, methods, and fields. The standard doclet interprets the content of documentation comments according to the JavaDoc Documentation Comment Specification for the Standard Doclet. Custom tags in documentation comments are supported by means of taglets. π§
You can use the javadoc tool and the standard doclet to generate the API documentation or the implementation documentation for a set of source files. π
You can run the javadoc tool on entire packages, individual source files, or both. When documenting entire packages, you can use the -subpackages option either 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. π
π¦ Documentation Comments π¦
The javadoc tool uses the documentation comment, if any, that immediately precedes the beginning of the declaration, whether that is an annotation, modifier, or the name being declared. If there are multiple documentation comments before the declaration, only the last one (closest to the declaration) will be used. If there are any documentation comments after the beginning of the declaration, they will be ignored. To check for any extra or misplaced documentation comments, compile your source code with the javac option -Xlint, or more specifically, -Xlint:dangling-doc-comments. Within a source file, you may suppress any warnings generated by these options by using @SuppressWarnings("dangling-doc-comments") on a suitable enclosing declaration. π«Ά
π Conformance π
The standard doclet does not validate the content of documentation comments for conformance, nor does it attempt to correct any errors in documentation comments. Anyone running javadoc is advised to be aware of the problems that may arise when generating non-conformant output or output containing executable content, such as JavaScript. The standard doclet does provide the DocLint feature to help developers detect common problems in documentation comments; but it is also recommended to check the generated output with any appropriate conformance and other checking tools. π
For more details on the conformance requirements for HTML5 documents, see Conformance requirements for authors (https://html.spec.whatwg.org/multipage/introduction.html#conformance-requirements-for-authors) in the HTML5 Specification. For more details on security issues related to web pages, see the Open Web Application Security Project (OWASP) (https://www.owasp.org) page. π₯
β¨ OPTIONS β¨
javadoc supports command-line options for both the main javadoc tool and the currently selected doclet. The standard doclet is used if no other doclet is specified. π
GNU-style options (that is, those beginning with --) can use an equal sign (=) instead of whitespace characters to separate the name of an option from its value. π
π Standard javadoc Options π
The following core javadoc options are equivalent to corresponding javac options. See Standard Options in javac for the detailed descriptions of using these options:
--add-modules-bootclasspath--class-path,-classpath, or-cp--disable-line-doc-comments--enable-preview-encoding-extdirs--limit-modules--module--module-pathor-p--module-source-path--release--sourceor-source--source-pathor-sourcepath--system--upgrade-module-path
The following options are the core javadoc options that are not equivalent to a corresponding javac option:
-breakiteratorβ Computes the first sentence of the description in a documentation comment using an instance ofjava.text.BreakIteratorto detect sentence breaks. The rules that are used depend on the current locale: for example, for English, a sentence break occurs after 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 option is enabled by default if the language of the current locale is not English. If the language of the current locale is English, and the -breakiterator option is not given, a simple default algorithm is used, which just looks for a period followed by a space. π
In a traditional /**...*/ comment, the search for the end of the first sentence is terminated by an HTML block tag, such as <p>, <pre>, or the tag for a heading. π
In a Markdown /// comment, the search for the end of the first sentence skips over any characters enclosed in code spans and links, and is terminated by the end of the initial block, as indicated by a blank line or the beginning of the next block, such as a list, thematic break, or an HTML block. π¦
The first sentence of the description in a documentation comment is used in summary tables, index pages, and other situations where a short summary is required. For more explicit control in any individual documentation comment, enclose the contents of the first sentence in a {@summary ...} tag, or when applicable, in a {@return ...} tag. β¨
-docletclass β Generates output by using an alternate doclet. Use the fully qualified name. This doclet defines the content and formats the output. If the-docletoption isn't used, then thejavadoctool uses the standard doclet for generating the default HTML format. This class must implement thejdk.javadoc.doclet.Docletinterface. The path to this class is defined by the-docletpathoption. π-docletpathpath β Specifies where to find doclet class files (specified with the-docletoption) 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 path contains multiple paths or JAR files, then they should be separated with a colon (:) on Linux and macOS, and a semicolon (;) on Windows. This option isn't necessary when the doclet starting class is already in the search path. πΈ-excludepkglist β Unconditionally, excludes the specified packages and their subpackages from the list formed by-subpackages. It excludes those packages even when they would otherwise be included by some earlier or later-subpackagesoption. π€
The following example would include java.io, java.util, and java.math (among others), but would exclude packages rooted at java.net and java.lang. Notice that these examples exclude java.lang.ref, which is a subpackage of java.lang. Arguments are separated by colons on all operating systems. π
- Linux and macOS:
javadoc -sourcepath /home/user/src -subpackages java -exclude java.net:java.lang - Windows:
javadoc -sourcepath \user\src -subpackages java -exclude java.net:java.lang
--expand-requires(transitive|all) β Instructs thejavadoctool to expand the set of modules to be documented. By default, only the modules given explicitly on the command line are documented. Supports the following values: π«Άtransitive: additionally includes all the required transitive dependencies of those modules.all: includes all dependencies.
--help,-help,-h, or-?β Prints a synopsis of the standard options. β¨--help-extraor-Xβ Prints a synopsis of the set of extra options. π-Jflagβ Passes flag directly to the Java Runtime Environment (JRE) that runs thejavadoctool. 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-Xmxoption as follows:javadoc -J-Xmx32m -J-Xms32m com.mypackage. Be aware that-Xmsis 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 J and the flag. π¨
Use the -version option to report the version of the JRE being used to run the javadoc tool. π
javadoc -J-version
java version "17" 2021-09-14 LTS
Java(TM) SE Runtime Environment (build 17+35-LTS-2724)
Java HotSpot(TM) 64-Bit Server VM (build 17+35-LTS-2724, mixed mode, sharing)
-locale nameβ tells thejavadoctool which locale to use when it's generating your docs, bestie. The argument is the locale name, as described in thejava.util.Localedocumentation β stuff likeen_US(English, United States) oren_US_WIN(the Windows variant) π
When you pick a locale, javadoc goes and grabs the resource files for that locale for all the messages β the strings in the navigation bar, headings for lists and tables, the help file contents, comments inside the stylesheet.css file, and so on β¨ It also decides the sorting order for lists that get sorted alphabetically, plus the sentence separator used to figure out where the first sentence ends π
β οΈ Real talk though: -locale does not set the locale of the documentation comment text you wrote inside the source files of the classes being documented. That's not its job, okay? π
-packageβ shows only package, protected, and public classes and members π«Ά-privateβ shows everything: all classes and all members. Full transparency, no secrets, main character energy π-protectedβ shows only protected and public classes and members. This one's the default, so if you do nothing, this is what you get πΈ-publicβ shows only the public classes and members. Very exclusive. VIP list only π-quietβ shuts off the messages so only warnings and errors show up, which makes them so much easier to actually look at π It also suppresses the version string, so it's giving minimalist icon behavior β¨--show-members valueβ says which members (fields, methods, or constructors) get documented.valuecan be any of these:publicβ shows only public membersprotectedβ shows public and protected members; this is the default βpackageβ shows public, protected, and package membersprivateβ shows all members π
--show-module-contents valueβ sets how granular the docs get for module declarations.valuecan beapiorallπ¦--show-packages valueβ says which module packages get documented.valuecan beexportedorallpackages π--show-types valueβ says which types (classes, interfaces, etc.) get documented.valuecan be any of these:publicβ shows only public typesprotectedβ shows public and protected types; this is the default βpackageβ shows public, protected, and package typesprivateβ shows all types π₯
-subpackages subpkglistβ generates docs from source files in the packages you name, and recursively in their subpackages. This one's a whole vibe when you're adding new subpackages to source code, because they get pulled in automatically, no extra effort π
Each package argument is any top-level subpackage (like java) or fully qualified package (like javax.swing) β and ngl, it doesn't even need to contain source files π Arguments are separated by colons on all operating systems. Wildcards are not allowed, periodt π« Use -sourcepath to tell it where to find the packages. Also note: this option doesn't process source files that live in the source tree but don't belong to the packages.
For example, these commands generate documentation for packages named java and javax.swing and all of their subpackages π
- Linux and macOS:
javadoc -d docs -sourcepath /home/user/src -subpackages java:javax.swing
- Windows:
javadoc -d docs -sourcepath \user\src -subpackages java:javax.swing
-verboseβ gives you more detailed messages whilejavadocruns π£οΈ Without-verbose, you get messages for loading the source files, generating the documentation (one message per source file), and sorting. With-verbose? You get additional messages specifying the number of milliseconds it took to parse each Java source file. Timestamped tea ββ¨--versionβ prints version information. Simple, iconic, does exactly what it says π-Werrorβ reports an error if any warnings occur. Like, it's not gonna let a single warning slide. No cap, one warning and it's an error π€
π Heads up, this one's important: if a Java source file contains an implicitly declared class, then that class and its public, protected, and package members will be documented regardless of options like--show-types,--show-members,-private,-protected,-package, and-public. It just bulldozes right past them. And if--show-membersis specified with valueprivate, or if-privateis used, then all private members of an implicitly declared class get documented too. So likeβ¦ know that going in π«Ά
π§ Extra javadoc Options
β οΈ Note: these extra options for javadoc are subject to change without notice. Not me being ominous, that's literally what the docs say π
The following extra javadoc options are equivalent to the corresponding javac options. See Extra Options in javac for the detailed descriptions of how to use them π
--add-exports--add-reads--patch-module-Xmaxerrs-Xmaxwarns
π Standard Options for the Standard Doclet
These are all provided by the standard doclet, bestie. Strap in π
--add-script fileβ addsfileas an extra JavaScript file to the generated documentation π₯ This option can be used one or more times to specify additional script files.
Command-line example:
javadoc --add-script first_script.js --add-script second_script.js pkg_foo
--add-stylesheet fileβ addsfileas an extra stylesheet file to the generated documentation π This option can also be used one or more times to specify additional stylesheets included in the documentation.
Command-line example:
javadoc --add-stylesheet new_stylesheet_1.css --add-stylesheet new_stylesheet_2.css pkg_foo
--allow-script-in-commentsβ allows JavaScript in documentation comments, and in options whose value is html-code β‘ So yeah, it's the "yes you may put scripts in there" permission slip.-authorβ includes the text of any author tags in the generated documentation βοΈ Give the people credit, they earned it π-bottom html-codeβ specifies the text to be placed at the bottom of every generated page. The text can contain HTML tags and white space, but when it does, you must wrap the text in quotation marks. And use escape characters for any internal quotation marks inside the text π-charset nameβ specifies the HTML character set for this document. Thenameshould be a preferred MIME name as specified in the IANA Registry, Character Sets [http://www.iana.org/assignments/character-sets] π
For example:
javadoc -charset "iso-8859-1" mypackage
This command inserts the following line β containing a meta element [https://html.spec.whatwg.org/multipage/semantics.html#the-meta-element] β into the head of every generated page:
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
-d directoryβ specifies the destination directory where thejavadoctool saves the generated HTML files π If you omit-d, the files get saved to the current directory. Thedirectoryvalue can be absolute or relative to the current working directory. And good news: the destination directory is automatically created when thejavadoctool runs β¨- Linux and macOS: for example, this command generates the documentation for the package
com.mypackageand saves the results in the/user/doc/directory:
- Linux and macOS: for example, this command generates the documentation for the package
javadoc -d /user/doc/ com.mypackage
- Windows: for example, this command generates the documentation for the package
com.mypackageand saves the results in the\user\doc\directory:
javadoc -d \user\doc\ com.mypackage
-docencoding nameβ specifies the encoding of the generated HTML files. Thenameshould be a preferred MIME name as specified in the IANA Registry, Character Sets [http://www.iana.org/assignments/character-sets] π¦
Okay so there are three encoding options you can use in a javadoc encoding command. Let me break it down because it's lowkey a lot π
-encodingis used for encoding the files read by thejavadoctool-docencodingand-charsetare used for encoding the files written by the tool
Of those three options, at most only the input encoding option and one output encoding option are used in a single encoding command. If you specify both input and output encoding options in a command, they must be the same value β οΈ And if you specify neither output option, it defaults to the input encoding π«Ά
For example:
javadoc -docencoding "iso-8859-1" mypackage
-docfilessubdirsβ this option is no longer required and may be removed in a future release π Thejavadoctool now recursively copies subdirectories ofdoc-filesdirectories by default, so it's kind of just vibing there. Use the-excludedocfilessubdiroption to restrict which subdirectories get copied π-doctitle html-codeβ specifies the title to place near the top of the overview summary file. The text specified in the title tag is placed as a centered, level-one heading directly beneath the navigation bar π
The title tag can contain HTML tags and white space, but when it does, you must enclose the title in quotation marks, and any additional quotation marks within the title tag must be escaped π
For example, javadoc -doctitle "<b>My Library</b><br>v1.0" com.mypackage.
-excludedocfilessubdir name1,name2...β excludes any subdirectories with the given names when recursively copyingdoc-filessubdirectories π« You can use*to exclude all subdirectories from being copied, but note that*must be quoted or escaped in the shell (the shell will absolutely eat it otherwise, bestie π). And for historical reasons,:can be used anywhere in the argument as a separator instead of,β¨-footer html-codeβ this option is no longer supported and reports a warning β οΈ Yeah. It's giving deprecated. Sad but true π-group name g1,g2...β groups the specified packages (or modules, when you're documenting modular code) together on the Overview page π For historical reasons,:can be used as a separator anywhere in the argument instead of,π-header html-codeβ sets the header text that sits at the top of every output file. It goes to the right of the navigation bar, bestie. The header can totally contain HTML tags and white space, but when it does you gotta wrap it in quotation marks, and use escape characters for any internal quotation marks. Example:
javadoc -header "<b>My Library</b><br>v1.0" com.mypackage
-helpfile filenameβ points to a file holding the text that pops up when someone clicks the HELP link in the navigation bar. Don't give this option and the javadoc tool just creates a default page that will be used. β¨-html5β this one is literally a no-op π and is just retained for backwards compatibility. Nothing happens. It's giving "still on the guest list but doesn't show up".--javafxor-javafxβ enables JavaFX functionality. It's enabled by default if the JavaFX library classes are detected on the module path. π§-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 don't look at<meta>tags, because pages can misuse them β rude but true π. Search engines offered by companies that confine their searches to their own website can benefit by looking at<meta>tags, though. The<meta>tags include the fully qualified name of the class and the unqualified names of the fields and methods. Constructors aren't included because they are identical to the class name. For example, the page for the classStringincludes these keywords:
<meta name="keywords" content="java.lang.String class">
<meta name="keywords" content="CASE_INSENSITIVE_ORDER">
<meta name="keywords" content="length()">
<meta name="keywords" content="isEmpty()">
-link urlβ creates links to existing javadoc generated documentation of externally referenced classes. Theurlargument is the absolute or relative URL of the directory that contains the external javadoc generated documentation. You can specify multiple-linkoptions in a single javadoc tool run to link to multiple documents. π
Either a package-list or an element-list file must be in this url directory (otherwise, use the -linkoffline option).
Note: thepackage-listandelement-listfiles are generated by the javadoc tool when generating the API documentation and should not be modified by the user. Leave them alone, bestie. π
When you use the javadoc tool to document packages, it uses the package-list file to determine the packages declared in an API. When you generate API documents for modules, the javadoc tool uses the element-list file to determine the modules and packages declared in an API.
The javadoc tool reads the names from the appropriate list file and then links to the packages or modules at that URL.
When the javadoc tool runs, the url value is copied into the <a href> links that are created. So url must be the URL to the directory and not to a file. No cap.
You can use an absolute link for url 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 -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 https:, http:, or file: as specified in the RFC 1738: Uniform Resource Locators (URL) [https://www.rfc-editor.org/info/rfc1738].
-link https://<host>/<directory>/<directory>/.../<name>
-link http://<host>/<directory>/<directory>/.../<name>
-link file://<host>/<directory>/<directory>/.../<name>
-link <directory>/<directory>/.../<name>
--link-modularity-mismatch (warn|info)β tells javadoc whether external documentation with the wrong modularity (e.g. non-modular documentation for a modular library, or the reverse case) should be reported as a warning (warn) or just a message (info). The default behavior is to report a warning. β οΈ-linkoffline url1 url2β this one's a variation of the-linkoption. They both create links to javadoc generated documentation for externally referenced classes, and yes, you can specify multiple-linkofflineoptions in a specified javadoc tool run. π¦
Use the -linkoffline option when:
- Linking to a document on the web that the javadoc tool can't access through a web connection
- The
package-listorelement-listfile of the external document either isn't accessible or doesn't exist at the URL location, but does exist at a different location and can be specified by either thepackage-listorelement-listfile (typically local)
Note: thepackage-listandelement-listfiles are generated by the javadoc tool when generating the API documentation and should not be modified by the user. Seriously, hands off π ββοΈ
If url1 is accessible only on the World Wide Web, then the -linkoffline option removes the constraint that the javadoc tool must have a web connection to generate documentation. Iconic problem-solving fr fr.
Another use of the -linkoffline option is as a work-around to update documents. After you have run the javadoc tool on a full set of packages or modules, you can run the javadoc tool again on a smaller set of changed packages or modules, so that the updated files can be inserted back into the original set.
For example, the -linkoffline option takes two arguments. The first is for the string to be embedded in the <a href> links, and the second tells the javadoc tool where to find either the package-list or element-list file.
The url1 or url2 value is the absolute or relative URL of the directory that contains the external javadoc generated documentation that you want to link to. When relative, the value should be the relative path from the destination directory (specified with the -d option) to the root of the packages being linked to. See url in the -link option. π
--link-platform-properties urlβ specifies a properties file used to configure links to platform documentation. Theurlargument is expected to point to a properties file containing one or more entries with the following format, where<version>is the platform version as passed to the--releaseor--sourceoption and<url>is the base URL of the corresponding platform API documentation:
doclet.platform.docs.<version>=<url>
For instance, a properties file containing URLs for releases 15 to 17 might contain the following lines:
doclet.platform.docs.15=https://example.com/api/15/
doclet.platform.docs.16=https://example.com/api/16/
doclet.platform.docs.17=https://example.com/api/17/
If the properties file does not contain an entry for a particular release, no platform links are generated. Simple as that. β¨
-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 aren't created, such as for default constructors and generated classes.
β οΈ Heads up bestie, 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-public,-package,-protected, and-privateoptions. Unless you also use the-privateoption, not all private classes or interfaces are accessible through links. Like, the privacy vibes are gone.
Each link appears on the name of the identifier in its declaration. For example, the link to the source code of the Button class would be on the word Button:
public class Button extends Component implements Accessible
The link to the source code of the getLabel method in the Button class is on the word getLabel:
public String getLabel()
--main-stylesheet fileor-stylesheetfile fileβ specifies the path of an alternate stylesheet file that contains the definitions for the CSS styles used in the generated documentation. This option lets you override the default. If you do not specify the option, the javadoc tool will create and use a default stylesheet. The file name can be any name and isn't restricted tostylesheet.css. The--main-stylesheetoption is the preferred form. π
Command-line example:
javadoc --main-stylesheet main_stylesheet.css pkg_foo
-nocommentβ suppresses the entire comment body, including the main description and all tags, and generates 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 during the early stages of a new project. Skeleton docs era ππ¦΄-nodeprecatedβ prevents the generation of any deprecated API in the documentation. This does what the-nodeprecatedlistoption does, and it doesn't generate any deprecated API throughout the rest of the documentation. This is useful when writing code when you don't want to be distracted by the deprecated code. Out of sight, out of mind, periodt. π-nodeprecatedlistβ skips generating the file that holds the list of deprecated APIs (deprecated-list.html) and the link to that page in the navigation bar π«. Important:javadocstill generates the deprecated API info throughout the rest of the document β it's just the dedicated list page and its nav link that dip out. Super handy when your source has zero deprecated APIs and you want that navigation bar looking clean and unbothered β¨.--no-fontsβ no font files get included in the generated docs π€. Genuinely useful when the documentation uses a custom stylesheet that doesn't use the default fonts β like, why ship fonts nobody's using, right? π-nohelpβ omits the HELP link in the navigation bar at the top of every generated page πβ‘οΈπ«.-noindexβ drops the index from the generated documents. Ngl the index is produced by default, so this is you actively choosing chaos-free minimalism π.-nonavbarβ prevents generation of the navigation bar and header π§. Heads up though:-nonavbarhas no effect on the-bottomoption. It's the move when you only care about the content and don't need navigation at all β say, when you're converting the files to PostScript or PDF for printing only π¨οΈ.--no-platform-linksβ stops links to platform documentation from being generated. Bestie, these links are generated by default, so this one's for when you want them gone π.-noqualifier name1,name2...β excludes that list of qualifiers from the output. The package name gets removed from places where class or interface names appear π·οΈ. For historical reasons,:can be used anywhere in the argument as a separator instead of,(iykyk, legacy behavior fr fr).
The following example omits all package qualifiers: -noqualifier all.
The following example omits java.lang and java.io package qualifiers: -noqualifier java.lang:java.io.
The following example omits package qualifiers starting with java and com.sun subpackages, but not javax: -noqualifier java.*:com.sun.*.
Where a package qualifier would appear because of the previous behavior, the name can be suitably shortened π. This rule is in effect whether or not the -noqualifier option is used β so like, it's always on, periodt.
-nosinceβ omits the Since sections derived from anysincetags from the generated docs π°οΈ.-notimestampβ suppresses the time stamp, which is hidden in an HTML comment in the generated HTML near the top of every page π΅οΈβοΈ. So useful when you want to runjavadocon two source bases and compare them, because it stops time stamps from causing a difference β and without it that difference would show up on every single page π. Oh, and the time stamp includes thejavadoctool release number, fun fact πΈ.-notreeβ omits the class and interface hierarchy pages from the generated documents π³β‘οΈπ«. Those are the pages you reach via the TREE link in the navigation bar. The hierarchy is produced by default, so this is you saying "not today."--override-methods (detail|summary)β documents overridden methods in the detail or summary sections. The default isdetailπ.-overview filenameβ tells thejavadoctool to grab the content for the overview documentation from the file specified by filename and drop it on the Overview page (overview-summary.html) πβ¨. If filename is a relative path, it's evaluated relative to the current working directory.
The file may be an HTML file with a filename ending in .html, or a Markdown file with a filename ending in .md. If it's an HTML file, the overview content comes from the <main> element in the file if one is present, or from the <body> element if there's no <main> element. If it's a Markdown file, the entire content of the file is used π.
The title on the overview page is set by -doctitle π.
Note: older versions of the javadoc tool assumed that any use of this option was for an HTML file, and allowed any extension for the filename π§π.
-serialwarnβ reports compile-time warnings for missing@serialtags β οΈ. By default, Javadoc reports no serial warnings. Use this option to display them, which helps you properly document default serializable fields andwriteExternalmethods π«Ά.--since release(,release)*β generates documentation for APIs that were added or newly deprecated in the specified releases π.
If the @since tag in the javadoc comment of an element in the documented source code matches a release passed as the option argument, info about the element and the release it was added in gets included in a "New API" page π.
If the "Deprecated API" page is generated and the since element of the java.lang.Deprecated annotation of a documented element matches a release in the option arguments, info about the release the element was deprecated in is added to the "Deprecated API" page ποΈ.
Releases are compared using case-sensitive string comparison π β so like, 2.0 β 2.0 if the casing wanders off.
--since-label textβ specifies the text to use in the heading of the "New API" page π·οΈ. It may contain info about the releases covered in the page, e.g."New API in release 2.0", or"New API since release 1"β¨.--snippet-path snippetpathlistβ specifies the search paths for finding files for external snippets π. The snippetpathlist can contain multiple paths by separating them with the platform path separator (;on Windows;:on other platforms). The standard doclet first searches thesnippet-filessubdirectory in the package containing the snippet, and then searches all the directories in the given list π.-sourcetab tab-lengthβ specifies the number of spaces each tab uses in the source π.--spec-base-url urlβ specifies the base URL for relative URLs in@spectags, to be used when generating links to any external specifications π. It can either be an absolute URL, or a relative URL β in which case it's evaluated relative to the base directory of the generated output files. The default value is equivalent to{@docRoot}/../specsπ.-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 π€πͺ. Alphabet supremacy, honestly.--syntax-highlightβ enables syntax highlighting for code fragments in{@snippet}tags and<pre><code>elements πβ¨. For snippets, thelangattribute determines the language of code fragments β it defaults to"java"for inline snippets and is derived from the file extension for external snippets. In HTML<pre><code>tags, theclassattribute can specify the language of the contained code fragment, like this:
<pre><code class="language-java">...</code></pre>
If neither of these attributes is available, automatic language detection is applied π€. To disable syntax highlighting for a code fragment, set the language to "text" using one of the mechanisms described above. The languages and formats supported by this option are Java, Properties, JSON, HTML and XML π¨.
-tag name:locations:headerβ specifies a custom tag with a single argument π·οΈ. For thejavadoctool to spell-check tag names, it's important to include a-tagoption for every custom tag present in the source code β disabling (withX) those that aren't being output in the current run. The colon (:) is always the separator. To include a colon in the tag name, escape it with a backward slash (\). The-tagoption outputs the tag heading, header, in bold, followed on the next line by the text from its single argument. Just like any block tag, the argument text can contain inline tags, which are also interpreted. The output looks similar to standard one-argument tags like the@returnand@authortags. If you omit a header value, the name becomes the heading π. locations is a list of characters specifying the kinds of declarations where the tag may be used. These characters work in either uppercase or lowercase:A: all declarationsC: constructorsF: fieldsM: methodsO: the overview page and other documentation files indoc-filessubdirectoriesP: packagesS: modulesT: types (classes and interfaces)X: nowhere β the tag is disabled and will be ignored π
The order in which tags are given on the command line is the order in which the tags appear in the generated output π. And you can include standard tags in the order given on the command line by using the -tag option with no locations or header β no cap, it just works.
-taglet classβ specifies the fully qualified name of the taglet used in generating the documentation for that tag π§©. Use the fully qualified name for the class value. This taglet also defines the number of text arguments the custom tag has. The taglet accepts those arguments, processes them, and generates the output β¨.
Taglets are useful for block or inline tags. They can have any number of arguments and implement custom behavior β like 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 can't do things like remove a class name from the list of included classes π
βοΈ. However, it can execute side effects, like printing the tag's text to a file or triggering another process π. Use the -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:
-taglet com.sun.tools.doclets.ToDoTaglet
-tagletpath /home/taglets
-tag return
-tag param
-tag todo
-tag throws
-tag see
Alternately, you can use the -taglet option in place of its -tag option, but bestie, that might be difficult to read π.
-tagletpathtagletpathlist β tells javadoc where to go hunting for taglet class files π. The tagletpathlist can hold multiple paths, separated by the platform path separator (;on Windows,:on other platforms). Thejavadoctool searches all subdirectories of the paths you give it.-tophtml-code β sets the text that gets placed at the top of every output file β¨.-useβ creates class and package usage pages, bestie π. That means 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 classC, things that use classCwould include subclasses ofC, fields declared asC, methods that returnC, and methods and constructors with parameters of typeC. For example, you can look at the Use page for theStringtype. Because thegetNamemethod in thejava.awt.Fontclass returns typeString, thegetNamemethod usesStringand so thegetNamemethod appears on the Use page forString. This documents only uses of the API, not the implementation. When a method usesStringin its implementation, but doesnβt take a string as an argument or return a string, that isnβt considered a use ofString. To access the generated Use page, go to the class or package and click theUSElink in the navigation bar π .-versionβ includes the text of any version tags in the generated documentation. This text is omitted by default. Note: To find out what version of thejavadoctool you are using, use the--versionoption (with two hyphens) π«Ά.-windowtitletitle β specifies the title to be placed in the HTML<title>tag. The text specified in the title 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 a browser will not interpret them correctly. Use escape characters on any internal quotation marks within the title tag. If the-windowtitleoption is omitted, then thejavadoctool uses the value of the-doctitleoption for the-windowtitleoption. For example:javadoc -windowtitle "My Library" com.mypackage.
β¨ Extra Options for the Standard Doclet β¨
The following are additional options provided by the standard doclet and are subject to change without notice. Additional options are less commonly used or are otherwise regarded as advanced π.
--datedate-and-time β specifies the value to be used to timestamp the generated pages, in ISO 8601 (https://www.iso.org/iso-8601-date-and-time-format.html) format. The specified value must be within 10 years of the current date and time. It is an error to specify both-notimestampand--date. Using a specific value means the generated documentation can be part of a reproducible build (https://reproducible-builds.org/) π. If the option is not given, the default value is the current date and time. For example:
javadoc --date 2022-02-01T17:41:59-08:00 mypackage
--legal-notices(default|none|directory)β specifies the location from which to copy legal files to the generated documentation. If the option is not specified or is used with the valuedefault, the files are copied from the default location. If the argument is used with valuenone, no files are copied. Every other argument is interpreted asdirectoryfrom which to copy the legal files π.--no-framesβ this option is no longer supported and reports a warning π.-Xdoclintβ enables recommended checks for problems in documentation comments. By default, the-Xdoclintoption is enabled. Disable it with the option-Xdoclint:none. For more details, see DocLint π₯.-Xdoclint:flag,flag,... β enables or disables specific checks for different kinds of issues in documentation comments. Each flag can be one ofall,none, or[-]groupwheregrouphas one of the following values:accessibility,html,missing,reference,syntax. For more details on these values, see DocLint Groups π.
When specifying two or more flags, you can either use a single -Xdoclint:... option, listing all the desired flags, or you can use multiple options giving one or more flag in each option. For example, use either of the following commands to check for the HTML, syntax, and accessibility issues in the file MyFile.java:
javadoc -Xdoclint:html -Xdoclint:syntax -Xdoclint:accessibility MyFile.java
javadoc -Xdoclint:html,syntax,accessibility MyFile.java
The following examples illustrate how to change what DocLint reports:
-Xdoclint:none--- disables all checks-Xdoclint:group--- enables group checks-Xdoclint:all--- enables all groups of checks-Xdoclint:all,-group--- enables all checks except group checks
For more details, see DocLint.
-Xdoclint/package:[-]packages β enables or disables checks in specific packages.packagesis a comma separated list of package specifiers. A package specifier is either a qualified name of a package or a package name prefix followed by*, which expands to all subpackages of the given package. Prefix the package specifier with-to disable checks for the specified packages π¦. For more details, see DocLint.-Xdocrootparenturl β replaces all@docRootitems followed by/..in documentation comments with url π.
π DOCLINT π
okay so DocLint is literally the vibe-checker for your documentation comments β it checks for possible problems in them. Problems may be reported as warnings or errors, depending on their severity. For example, a missing comment may be bad style that deserves a warning, but a link to an unknown Java declaration is more serious and deserves an error. Problems are organized into groups, and options can be used to enable or disable messages in one or more groups. Within the source code, messages in one or more groups can be suppressed by using @SuppressWarnings annotations. β¨
When invoked from javadoc, by default DocLint checks all comments that are used in the generated documentation. It thus relies on other command-line options to determine which declarations, and which corresponding documentation comments, will be included. Note: this may mean that even comments on some private members of serializable classes will also be checked, if the members need to be documented in the generated Serialized Forms page. π
In contrast, when DocLint is invoked from javac, DocLint solely relies on the various -Xdoclint... options to determine which documentation comments to check.
DocLint doesn't attempt to fix invalid input, it just reports it. no cap, it's giving "I'm not your editor, I'm your mirror" π
Note: DocLint doesn't guarantee the completeness of these checks. In particular, it isn't a full HTML compliance checker. The goal is to just report common errors in a convenient manner.
πΈ Groups πΈ
The checks performed by DocLint are organized into groups. The warnings and errors in each group can be enabled or disabled with command-line options, or suppressed with @SuppressWarnings annotations.
The groups are as follows:
accessibilityβ Checks for issues related to accessibility. For example, noaltattribute specified in an<img>element, or nocaptionorsummaryattributes specified in a<table>element. π¦
Issues are reported as errors if a downstream validation tool might be expected to report an error in the files generated by javadoc.
For reference, see the Web Content Accessibility Guidelines [https://www.w3.org/WAI/standards-guidelines/wcag/].
htmlβ Detects common high-level HTML issues. For example, putting block elements inside inline elements, or not closing elements that require an end tag. π
Issues are reported as errors if a downstream validation tool might be expected to report an error in the files generated by javadoc.
For reference, see the HTML Living Standard [https://html.spec.whatwg.org/multipage/].
missingβ Checks for missing documentation comments or tags. For example, a missing comment on a class declaration, or a missing@paramor@returntag in the comment for a method declaration. π
Issues related to missing items are typically reported as warnings because they are unlikely to be reported as errors by downstream validation tools that may be used to check the output generated by javadoc.
referenceβ Checks for issues relating to the references to Java API elements from documentation comment tags. For example, the reference in@seeor{@link ...}cannot be found, or a bad name is given for@paramor@throws. π₯
Issues are typically reported as errors because while the issue may not cause problems in the generated files, the author has likely made a mistake that will lead to incorrect or unexpected documentation.
syntaxβ Checks for low-level syntactic issues in documentation comments. For example, unescaped angle brackets (<and>) and ampersands (&) and invalid documentation comment tags. π
Issues are typically reported as errors because the issues may lead to incorrect or unexpected documentation.
π Suppressing Messages π
DocLint checks for and recognizes two strings that may be present in the arguments for an @SuppressWarnings annotation.
doclintdoclint:LIST
where LIST is a comma-separated list of one or more of accessibility, html, missing, reference, syntax.
The names in LIST are the same group names supported by the command-line -Xdoclint option for javac and javadoc. (This is the same convention honored by the javac -Xlint option and the corresponding names supported by @SuppressWarnings.) π«Ά
The names in LIST can equivalently be specified in separate arguments of the annotation. For example, the following are equivalent:
@SuppressWarnings("doclint:accessibility,missing")@SuppressWarnings("doclint:accessibility", "doclint:missing")
When DocLint detects an issue in a documentation comment, it checks for the presence of @SuppressWarnings on the associated declaration and on all lexically enclosing declarations. The issue will be ignored if any such annotation is found containing the simple string doclint or the longer form doclint:LIST where LIST contains the name of the group for the issue. β¨
Note: as with other uses of @SuppressWarnings, using the annotation on a module or package declaration only affects that declaration; it does not affect the contents of the module or package in other source files.
All messages related to an issue are suppressed by the presence of an appropriate @SuppressWarnings annotation: this includes errors as well as warnings.
Note: It is only possible to suppress messages. If an annotation of @SuppressWarnings("doclint") is given on a top-level declaration, all DocLint messages for that declaration and any enclosed declarations will be suppressed; it is not possible to selectively re-enable messages for issues in enclosed declarations.
π¦ Comparison with downstream validation tools π¦
DocLint is a utility built into javac and javadoc that checks the content of documentation comments, as found in source files. In contrast, downstream validation tools can be used to validate the output generated from those documentation comments by javadoc and the standard doclet.
Although there is some overlap in functionality, the two mechanisms are different and each has its own strengths and weaknesses. β
- Downstream validation tools can check the end result of any generated documentation, as it will be seen by the end user. This includes content from all sources, including documentation comments, the standard doclet itself, user-provided taglets, and content supplied via command-line options. Because such tools are analyzing complete HTML pages, they can do more complete checks than can DocLint. However, when a problem is found in the generated pages, it can be harder to track down exactly where in the build pipeline the problem needs to be fixed. π
- DocLint checks the content of documentation comments, in source files. This makes it very easy to identify the exact position of any issues that may be found. DocLint can also detect some semantic errors in documentation comments that downstream tools cannot detect, such as missing comments, using an
@returntag in a method returningvoid, or an@paramtag describing a non-existent parameter. But by its nature, DocLint cannot report on problems such as missing links, or errors in user-provided custom taglets, or problems in the standard doclet itself. It also cannot reliably detect errors in documentation comments at the boundaries between content in a documentation comment and content generated by a custom taglet. π§
okay bestie, that's the whole page β this iconic manual is JAVADOC(1), from JDK 27-ea, dated 2026. byeee, stay slay ππ¦
π¦ where this page comes from
- epel 10: java-latest-openjdk-devel 1:27.0.0.0.35-0.0.1.0.ea.el10_3 Β· Apache-1.1 AND Apache-2.0 AND LicenseRef-Callaway-BSD AND LicenseRef-Callaway-BSD-with-advertising AND GPL-1.0-or-later AND GPL-2.0-only AND LicenseRef-Callaway-GPLv2-with-exceptions AND IJG AND LicenseRef-Callaway-LGPLv2+ AND LicenseRef-Callaway-MIT AND MPL-2.0 AND LicenseRef-Callaway-Public-Domain AND W3C AND Zlib AND ISC AND FTL AND LicenseRef-RSA
- epel 10: java-latest-openjdk-devel-fastdebug 1:27.0.0.0.35-0.0.1.0.ea.el10_3 Β· Apache-1.1 AND Apache-2.0 AND LicenseRef-Callaway-BSD AND LicenseRef-Callaway-BSD-with-advertising AND GPL-1.0-or-later AND GPL-2.0-only AND LicenseRef-Callaway-GPLv2-with-exceptions AND IJG AND LicenseRef-Callaway-LGPLv2+ AND LicenseRef-Callaway-MIT AND MPL-2.0 AND LicenseRef-Callaway-Public-Domain AND W3C AND Zlib AND ISC AND FTL AND LicenseRef-RSA
- epel 10: java-latest-openjdk-devel-slowdebug 1:27.0.0.0.35-0.0.1.0.ea.el10_3 Β· Apache-1.1 AND Apache-2.0 AND LicenseRef-Callaway-BSD AND LicenseRef-Callaway-BSD-with-advertising AND GPL-1.0-or-later AND GPL-2.0-only AND LicenseRef-Callaway-GPLv2-with-exceptions AND IJG AND LicenseRef-Callaway-LGPLv2+ AND LicenseRef-Callaway-MIT AND MPL-2.0 AND LicenseRef-Callaway-Public-Domain AND W3C AND Zlib AND ISC AND FTL AND LicenseRef-RSA
- epel 9: java-latest-openjdk-devel 1:27.0.0.0.35-0.0.1.0.ea.el9 Β· Apache-1.1 AND Apache-2.0 AND LicenseRef-Callaway-BSD AND LicenseRef-Callaway-BSD-with-advertising AND GPL-1.0-or-later AND GPL-2.0-only AND LicenseRef-Callaway-GPLv2-with-exceptions AND IJG AND LicenseRef-Callaway-LGPLv2+ AND LicenseRef-Callaway-MIT AND MPL-2.0 AND LicenseRef-Callaway-Public-Domain AND W3C AND Zlib AND ISC AND FTL AND LicenseRef-RSA
- epel 9: java-latest-openjdk-devel-fastdebug 1:27.0.0.0.35-0.0.1.0.ea.el9 Β· Apache-1.1 AND Apache-2.0 AND LicenseRef-Callaway-BSD AND LicenseRef-Callaway-BSD-with-advertising AND GPL-1.0-or-later AND GPL-2.0-only AND LicenseRef-Callaway-GPLv2-with-exceptions AND IJG AND LicenseRef-Callaway-LGPLv2+ AND LicenseRef-Callaway-MIT AND MPL-2.0 AND LicenseRef-Callaway-Public-Domain AND W3C AND Zlib AND ISC AND FTL AND LicenseRef-RSA
- epel 9: java-latest-openjdk-devel-slowdebug 1:27.0.0.0.35-0.0.1.0.ea.el9 Β· Apache-1.1 AND Apache-2.0 AND LicenseRef-Callaway-BSD AND LicenseRef-Callaway-BSD-with-advertising AND GPL-1.0-or-later AND GPL-2.0-only AND LicenseRef-Callaway-GPLv2-with-exceptions AND IJG AND LicenseRef-Callaway-LGPLv2+ AND LicenseRef-Callaway-MIT AND MPL-2.0 AND LicenseRef-Callaway-Public-Domain AND W3C AND Zlib AND ISC AND FTL AND LicenseRef-RSA
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms