Java Language Documenting Java Code Building Javadocs From the Command Line


Many IDEs provide support for generating HTML from Javadocs automatically; some build tools (Maven and Gradle, for example) also have plugins that can handle the HTML creation.

However, these tools are not required to generate the Javadoc HTML; this can be done using the command line javadoc tool.

The most basic usage of the tool is:


Which will generate HTML from the Javadoc comments in

A more practical use of the command line tool, which will recursively read all java files in [source-directory], create documentation for [] and all sub-packages, and place the generated HTML in the [docs-directory] is:

javadoc -d [docs-directory] -subpackages -sourcepath [source-directory] []