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:
javadoc JavaFile.java
Which will generate HTML from the Javadoc comments in JavaFile.java
.
A more practical use of the command line tool, which will recursively read all java files in [source-directory]
, create documentation for [package.name]
and all sub-packages, and place the generated HTML in the [docs-directory]
is:
javadoc -d [docs-directory] -subpackages -sourcepath [source-directory] [package.name]