The first is the demo of a simple Javadoc usage:1. Create a normal Java Project
The root path of the project source code is E:\ANDROIDWORKSPACE\JAVADOC\SRC
Project structure:
Project Source:
Net.qingtian.doc.Teacher :
Package net.qingtian.doc;/** * Teacher * * @author sunny day * @see net.qingtian.doc.aa#st Udent Reference * */public class Teacher {/** * gender */public String sex;/** * Show gender */public void Showsex () {}}
net.qingtian.doc.aa.Student:
Package net.qingtian.doc.aa;/** * Students * @author Sunny */public class Student {/** * name */public String name;/** * Display name */p ublic void ShowName () {}}
Net.qingtian.doc.package.html:
2. Generate API DocumentationA) Create the MyDoc folder under the E drive and store the generated API documentation.
b) Open the Black window under Windows, and then go to the root of the project source code, take the above project as an example, the source root directory is E:\ANDROIDWORKSPACE\JAVADOC\SRC
C:\USERS\ADMINISTRATOR>E:E:\>CD e:\androidworkspace\javadoc\drce:\androidworkspace\javadoc\src>
Ccreate a file under the E disk e:\ file.txt (the name of the file can be arbitrary, as long as the subsequent use of the corresponding with this can be). The contents of the file areNet.qingtian.doc.aanet.qingtian.doc
d) Execute command in black window: javadoc-d e:\mydoc e:\file.txtnamely e:\androidworkspace\javadoc\src>javadoc-d E:\mydoc E:\file.txt
e) The document has been generated to view
frequently encountered problems with Javadoc: first Javadoc command format javadoc [options] [packagenames] [sourcefiles] [@files]
Span style= "White-space:pre" > 1.options option (-D e:\mydoc Set output path) (-public/- Protect/-private Set which documents are generated
2. When using Javadoc, you can use the following parameters - SourcePath e:\androidworkspace\javadoc\src To set the root path of the source code that needs to generate the API documentation, we did not use this option in the operation we just made. Because we set the current path of the black window to the root path of the source code, we can not use this option.
3. When using Javadoc, you can set-classpath classpathlist this parameter, similar to-sourcepath Sourcepathlist, just one of them is the path of the source code, one is the path of the binary file, rather than having the reference to the external jar file when set, is not very common.
4.javadoc can generate API documentation for packages and for files, and cannot be generated recursively for the generation of documents for a package. If the package is more, then we need to put all the packages as parameters at the end of the Black Window command, which is of course inconvenient. So there is a simple way, also just used in the demo, is to put these package names in a file, at the end of the command to specify the use of this file can be @filePath
5. Chinese garbled, Javadoc default is GBK encoding, if the project is using UTF-8 encoding, then the Javadoc command to add options -encoding UTF-8-charset UTF-8
6. Reference http://www.360doc.com/content/06/0901/14/5874_196090.shtml
Using Javadoc to Generate API Web page documents