javadoc

generates API documentation from Java source code

TLDR

Generate documentation
$ javadoc [*.java]
Output to directory
$ javadoc -d [docs/] [*.java]
Include private members
$ javadoc -private [*.java]
Generate with classpath
$ javadoc -cp [lib/*] [src/*.java]
Document package
$ javadoc -d [docs/] -sourcepath [src/] [com.example]
Link to external docs
$ javadoc -link [https://docs.oracle.com/javase/17/docs/api/] [*.java]

SYNOPSIS

javadoc [options] sources...

DESCRIPTION

javadoc generates API documentation from Java source code. It parses Javadoc comments and produces HTML pages.The tool creates navigable documentation with class hierarchies, method details, and cross-references. It's the standard Java documentation generator.

PARAMETERS

-d DIR

Output directory.
-sourcepath PATH
Source file path.
-cp PATH
Classpath for dependencies.
-private
Include all members.
-public
Include only public.
-link URL
Link to external documentation.
-author
Include @author tags.
-version
Include @version tags.
-subpackages PKGS
Recursively process subpackages (colon-separated).
-encoding NAME
Source file encoding.
-windowtitle TITLE
Browser window title.
-doctitle TITLE
Title on the overview page.
--help
Display help information.

CAVEATS

Requires source code. Comment format matters. Large projects may be slow.

HISTORY

javadoc has been part of the JDK since Java 1.0, created by Sun Microsystems for generating API documentation.

SEE ALSO

javac(1), java(1), doxygen(1)