← 返回命令列表

Linux command

javadoc 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

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]

说明

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.

参数

-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.

FAQ

What is the javadoc command used for?

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.

How do I run a basic javadoc example?

Run `javadoc [*.java]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -d _DIR_ do in javadoc?

Output directory.