Using Javadoc to Generate API Web page documents

Source: Internet
Author: User

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 Documentation

A) 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 are

Net.qingtian.doc.aanet.qingtian.doc
d) Execute command in black window: javadoc-d e:\mydoc e:\file.txt

namely 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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.