![]() | This article contains instructions, advice, or how-to content. (August 2023) |
Javadoc is an API documentation generator for the Java programming language. Based on information in Java source code, Javadoc generates documentation formatted as HTML and via extensions, other formats.[1] Javadoc was created by Sun Microsystems and is owned by Oracle today.
The content and formatting of a resulting document are controlled via special markup in source code comments. As this markup is de facto standard and ubiquitous for documenting Java code,[2] many IDEs extract and display the Javadoc information while viewing the source code; often via hover over an associated symbol. Some IDEs, like IntelliJ IDEA, NetBeans and Eclipse, support generating Javadoc template comment blocks.[3] The @tag
syntax of Javadoc markup has been re-used by other documentation generators, including Doxygen, JSDoc, EDoc and HeaderDoc.
Javadoc supports extension via doclets and taglets, which allow for generating different output formats and for static analysis of a codebase. For example, JDiff reports changes between two versions of an API.
Although some criticize Javadoc and API document generators in general, one motivation for creating Javadoc was that more traditional (less automated) API documentation is often out-of-date or does not exist due to business constraints such as limited availability of technical writers.[4]
Javadoc has been part of Java since its first release, and is often updated with each release of the Java Development Kit.[5]
Javadoc and the source code comments used by Javadoc, do not affect the performance of a Java executable since comments are ignored by the compiler.
When I did the original JavaDoc in the original compiler, even the people close around me pretty soundly criticized it. And it was interesting, because the usual criticism was: a good tech writer could do a lot better job than the JavaDoc does. And the answer is, well, yeah, but how many APIs are actually documented by good tech writers? And how many of them actually update their documentation often enough to be useful?