javadoc - Document Generator Command and Options

This section describes what are the commonly used command line options for the Java document generator - 'javadoc' tool.

What Is "javadoc"? - "javadoc" is a command line tool that generates HTML pages of API documentation from Java source files.

"javadoc" has been included in JDK installation since JDK 1.0. And it is represented by the %java_home%\bin\javadoc.exe program file.

"javadoc" command has the following syntax:

javadoc [options] [packagenames] [sourcefiles] [@files]

where "options" is a list of options, "packagenames" is a list of Java package names to be documented, "sourcefiles" is a list of Java source files from which documents will be generated, and "@files" is a list of to provide additional command line options.

If you have %java_home%\bin directory included in "path" the environment variable, you can run "javadoc -help" to see the complete list of all options:

herong> javadoc -help

Usage:
  javadoc [options] [packagenames] [sourcefiles] [@files]
where options include:
  @<file>  Read options and filenames from file
  --add-modules <module>(,<module>)*
      Root modules to resolve in addition to the initial modules,
      or all modules on the module path if <module> is
      ALL-MODULE-PATH.
  --class-path <path>, -classpath <path>, -cp <path>
      Specify where to find user class files
  -doclet <class>
      Generate output via alternate doclet
  -encoding <name>
      Source file encoding name
  -exclude <pkglist>
      Specify a list of packages to exclude
  --help, -help, -?, -h
      Display command-line options and exit
  --module <module>(,<module>)*
      Document the specified module(s)
  -package
      Show package/protected/public types and members. For
      named modules, show all packages and all module details.
  -private
      Show all types and members. For named modules,
      show all packages and all module details.
  -protected
      Show protected/public types and members (default). For
      named modules, show exported packages and the module's API.
  -public
      Show only public types and members. For named modules,
      show exported packages and the module's API.
  -quiet  Do not display status messages
  --release <release>
      Provide source compatibility with specified release
  --show-members <value>
      Specifies which members (fields, methods, etc.) will be
      documented, where value can be one of "public", "protected",
      "package" or "private". The default is "protected", which will
      show public and protected members, "public" will show only
      public members, "package" will show public, protected and
      package members and "private" will show all members.
  --show-module-contents <value>
      Specifies the documentation granularity of module
      declarations. Possible values are "api" or "all".
  --show-packages <value>
      Specifies which modules packages will be documented. Possible
      values are "exported" or "all" packages.
  --show-types <value>
      Specifies which types (classes, interfaces, etc.) will be
      documented, where value can be one of "public", "protected",
      "package" or "private". The default is "protected", which will
      show public and protected types, "public" will show only
      public types, "package" will show public, protected and
      package types and "private" will show all types.
  --source-path <path>, -sourcepath <path>
      Specify where to find source files
  -verbose  Output messages about what Javadoc is doing
  --version  Print version information
  -Werror  Report an error if any warnings occur
  ...

Provided by the Standard doclet:
  --add-stylesheet <file>
      Additional stylesheet file for the generated documentation
  --allow-script-in-comments
      Allow JavaScript in options and comments
  -author  Include @author paragraphs
  ...

GNU-style options may use = instead of whitespace to separate the name
of an option from its value.

For more information, see "javadoc" reference page at https://docs.oracle.com/en/java/javase/17/docs/specs/man/javadoc.html.

Table of Contents

 About This Book

 Java Tools Terminology

 Java Tools Included in JDK

 javac - The Java Program Compiler

 java - The Java Program Launcher

 jar - The JAR File Tool

 jlink - The JRE Linker

 jmod - The JMOD File Tool

 jimage - The JIMAGE File Tool

 jpackage - Binary Package Builder

javadoc - The Java Document Generator

javadoc - Document Generator Command and Options

 Hello.java API Document

 HelloDocumented.java - javadoc-Style Comments

 Generate API Document for Java Package

 jdeps - The Java Class Dependency Analyzer

 jdeprscan - The Java Deprecated API Scanner

 jdb - The Java Debugger

 jcmd - The JVM Diagnostic Tool

 jconsole - Java Monitoring and Management Console

 jstat - JVM Statistics Monitoring Tool

 JVM Troubleshooting Tools

 jhsdb - The Java HotSpot Debugger

 jvisualvm (Java VisualVM) - JVM Visual Tool

 jmc - Java Mission Control

 javap - The Java Class File Disassembler

 keytool - Public Key Certificate Tool

 jarsigner - JAR File Signer

 jshell - Java Language Shell

 jrunscript - Script Code Shell

 Miscellaneous Tools

 native2ascii - Native-to-ASCII Encoding Converter

 JAB (Java Access Bridge) for Windows

 Archived Tutorials

 References

 Full Version in PDF/EPUB