A. Generate Java documentation, to understand the Java comment content, if you do not know, you can look at an article.
Two. The Java system provides Javadoc tools to automatically generate annotation documents based on the program structure. When the program is modified, it is convenient to update the generated comment document in time. The Javadoc.exe tool exists in the bin directory of the JDK, and using Javadoc will read the document comments in the. Java source file and compile it along with the Java source program in accordance with certain rules to generate the document.
Three. Javadoc Common Tags:
(above from Javadoc Baidu Encyclopedia, the reader can also go to Baidu Encyclopedia to see), in addition to these, there are some not commonly used markers, here is not listed.
Four. General form of the Javadoc command:
Javadoc [Options] [packages] [sourcefiles] [@files]
There are 4 sets of options in the command, and the square brackets themselves are not part of the command. Each option in the command line is separated by one or more spaces. Purpose of each group of options:
①options, specify the command options when executing Javadoc, and if you want to display standard command options, use the following command: Javadoc-help
②packages, a series of package names that need to be processed, separated by one or more spaces between names
③sourcefiles, a series of source file names separated by spaces, you can use wildcards, and if you want to specify all the source files for the current directory, you can use *.java to represent
④ @files, the name of one or more source files separated by spaces, or one or more packages, each file must be prefixed with @
Five. There are a lot of options in Javadoc, the following are the common options:
①-author, generating @author tags
②-version, generating @version tags
③-package, exporting documents to packages, public or protected classes and members
④-public, exporting documents to public classes and members
⑤-protected, export documents to public and protected classes and public class members
⑥-private, generate document annotations for all classes and members
⑦-d directoryname, so that Javadoc generated HTML files are stored in the specified directory. Default View current directory
Six. Example
Java code:
Attention:
① This class must use public decoration, which means the opening up, so that Javadoc can extract the annotated document;
The methods in the ② class, including constructs, do not show this method in the generated comment document if you use the private adornment, which is the internal calling class in this class, because private represents it as not open.
At the command prompt (go to the source program directory):
①javadoc-d myhelp-author-version Arraytool.java
(Here Myhelp refers to the generated help document will be placed in the source directory under the MYHELP subdirectory, this directory can also be set itself, as long as the full path can be, if the local disk does not have a folder, the Myhelp folder will be automatically generated)
about how to build a Java document