LinuxCommandLibrary

javadoc

Generate Java API documentation in HTML format from source code.

TLDR

Generate documentation for Java source code and save the result in a directory

$ javadoc -d [path/to/directory/] [path/to/java_source_code]
copy


Generate documentation with a specific encoding
$ javadoc -docencoding [UTF-8] [path/to/java_source_code]
copy


Generate documentation excluding some packages
$ javadoc -exclude [package_list] [path/to/java_source_code]
copy

Help

Usage:
    javadoc [options] [packagenames] [sourcefiles] [@files] 
where options include:
    --add-modules (,)* 
                  Root modules to resolve in addition to the initial modules, 
                  or all modules on the module path if  is 
                  ALL-MODULE-PATH. 
    -bootclasspath  
                  Override location of platform class files used for non-modular 
                  releases 
    -breakiterator 
                  Compute first sentence with BreakIterator 
    --class-path -classpath -cp  
                  Specify where to find user class files 
    -doclet  
                  Generate output via alternate doclet 
    -docletpath  
                  Specify where to find doclet class files 
    --enable-preview 
                  Enable preview language features. To be used in conjunction with 
                  either -source or --release. 
    -encoding  
                  Source file encoding name 
    -exclude  
                  Specify a list of packages to exclude 
    --expand-requires  
                  Instructs the tool to expand the set of modules to be 
                  documented. By default, only the modules given explicitly on 
                  the command line will be documented. A value of "transitive" 
                  will additionally include all "requires transitive" 
                  dependencies of those modules. A value of "all" will include 
                  all dependencies of those modules. 
    -extdirs  
                  Override location of installed extensions 
    --help, -help, -?, -h 
                  Display command line options and exit 
    --help-extra, -X 
                  Print a synopsis of nonstandard options and exit 
    -J      Pass  directly to the runtime system 
    --limit-modules (,)* 
                  Limit the universe of observable modules 
    -locale  
                  Locale to be used, e.g. en_US or en_US_WIN 
    --module (,)* 
                  Document the specified module(s) 
    --module-path -p  
                  Specify where to find application modules 
    --module-source-path  
                  Specify where to find input source files for multiple modules 
    -package 
                  Show package/protected/public types and members. For  
                  named modules, show all packages and all module details. 
    -private 
                  Show all types and members. For named modules, 
                  show all packages and all module details. 
    -protected 
                  Show protected/public types and members (default). For 
                  named modules, show exported packages and the module's API. 
    -public 
                  Show only public types and members. For named modules, 
                  show exported packages and the module's API. 
    -quiet        Do not display status messages 
    --release  
                  Provide source compatibility with specified release 
    --show-members  
                  Specifies which members (fields, methods, etc.) will be 
                  documented, where value can be one of "public", "protected", 
                  "package" or "private". The default is "protected", which will 
                  show public and protected members, "public" will show only 
                  public members, "package" will show public, protected and 
                  package members and "private" will show all members. 
    --show-module-contents  
                  Specifies the documentation granularity of module 
                  declarations. Possible values are "api" or "all". 
    --show-packages  
                  Specifies which modules packages will be documented. Possible 
                  values are "exported" or "all" packages. 
    --show-types  
                  Specifies which types (classes, interfaces, etc.) will be 
                  documented, where value can be one of "public", "protected", 
                  "package" or "private". The default is "protected", which will 
                  show public and protected types, "public" will show only 
                  public types, "package" will show public, protected and 
                  package types and "private" will show all types. 
    -source  
                  Provide source compatibility with specified release 
    --source-path -sourcepath  
                  Specify where to find source files 
    -subpackages  
                  Specify subpackages to recursively load 
    --system  
                  Override location of system modules used for modular releases 
    --upgrade-module-path  
                  Override location of upgradeable modules 
    -verbose      Output messages about what Javadoc is doing 
    --version     Print version information 

Provided by the Standard doclet:
    --add-stylesheet  
                  Additional stylesheet file for the generated documentation 
    --allow-script-in-comments 
                  Allow JavaScript in options and comments 
    -author       Include @author paragraphs 
    -bottom  
                  Include bottom text for each page 
    -charset  
                  Charset for cross-platform viewing of generated documentation 
    -d  
                  Destination directory for output files 
    -docencoding  
                  Specify the character encoding for the output 
    -docfilessubdirs 
                  Recursively copy doc-file subdirectories 
    -doctitle  
                  Include title for the overview page 
    -excludedocfilessubdir :.. 
                  Exclude any doc-files subdirectories with given name 
    -footer  
                  Include footer text for each page 
    --frames      Enable the use of frames in the generated output 
    -group  :... 
                  Group specified elements together in overview page 
    -header  
                  Include header text for each page 
    -helpfile  
                  Include file that help link links to 
    -html4        Generate HTML 4.01 output 
    -html5        Generate HTML 5 output 
    --javafx, -javafx 
                  Enable JavaFX functionality 
    -keywords     Include HTML meta tags with package, class and member info 
    --legal-notices 'default' | 'none' |  
                  Control legal notices in the generated output 
    -link    Create links to javadoc output at  
    -linkoffline   
                  Link to docs at  using package list at  
    -linksource   Generate source in HTML 
    --main-stylesheet -stylesheetfile  
                  File to change style of the generated documentation 
    -nocomment    Suppress description and tags, generate only declarations 
    -nodeprecated 
                  Do not include @deprecated information 
    -nodeprecatedlist 
                  Do not generate deprecated list 
    --no-frames   Disable the use of frames in the generated output (default) 
    -nohelp       Do not generate help link 
    -noindex      Do not generate index 
    -nonavbar     Do not generate navigation bar 
    -noqualifier ::.. 
                  Exclude the list of qualifiers from the output 
    -nosince      Do not include @since information 
    -notimestamp  Do not include hidden time stamp 
    -notree       Do not generate class hierarchy 
    --override-methods (detail|summary) 
                  Document overridden methods in the detail or summary sections 
    -overview  
                  Read overview documentation from HTML file 
    -serialwarn   Generate warning about @serial tag 
    -sourcetab  
                  Specify the number of spaces each tab takes up in the source 
    -splitindex   Split index into one file per letter 
    -tag ::

 
                  Specify single argument custom tags 
    -taglet       The fully qualified name of Taglet to register 
    -tagletpath   The path to Taglets 
    -top  
                  Include top text for each page 
    -use          Create class and package usage pages 
    -version      Include @version paragraphs 
    -windowtitle  
                  Browser window title for the documentation 

GNU-style options may use = instead of whitespace to separate the name of an 
option from its value. 

Copied to clipboard