javadoc
Generate Java documentation from source code
TLDR
Generate documentation for Java source code and save the result in a directory
Generate documentation with a specific encoding
Generate documentation excluding some packages
SYNOPSIS
javadoc [options] [packagelist] [classlist] [@files]
PARAMETERS
-d directory
Destination directory for output
-doclet class
Class name of custom doclet
-docletpath classpath
Path to doclet classes
-encoding name
Encoding for source files
-exclude packagelist
Packages to exclude
-help
Print help message
-Jflag
Pass flag to JVM
-locale name
Locale for output
-overview file
Read overview from file
-package
Include package descriptions
-private
Include private members (default)
-protected
Include protected members
-public
Include only public members
-quiet
Suppress non-error messages
-source version
Source code language version
-sourcepath pathlist
Search path for sources
-subpackages pkg1[:pkg2]:...
Subpackages to document recursively
-use
Include class-use pages
DESCRIPTION
The javadoc command is a documentation generator tool included in the Java Development Kit (JDK). It reads Java source files and extracts specially formatted comments (doc comments starting with /**) to produce comprehensive HTML-based API documentation. This includes class hierarchies, method signatures, field lists, package summaries, and cross-referenced indexes.
Javadoc supports standard doc tags like @param, @return, @see, @author, and @version, enabling structured documentation. It processes entire packages or individual classes, generating frames-based or non-frames navigation. Custom doclets allow output in other formats like XML or PDF.
Key features include overview pages, package summaries, class use pages, deprecated lists, and serialization info. It handles inner classes, enums, annotations, and generics from modern Java. Source paths, encodings, and exclusions enhance flexibility for large projects.
CAVEATS
Requires JDK installation; processes only source files with doc comments; large projects may need memory tuning via -J flags; HTML5 output since JDK 9; deprecated options in newer versions.
EXAMPLE USAGE
javadoc -d docs -sourcepath src java.lang
Generates docs for java.lang package into docs directory.
DOC COMMENT BASICS
Use /** ... */ for comments; inline tags like {@link Class#method} for links.
HISTORY
Developed by Sun Microsystems in 1995 for Java 1.0; evolved with Java features like generics (JDK 5) and modules (JDK 9); now maintained by Oracle, with HTML5 standarddoclet replacing old frames.


