How Java extracts comments from a program to generate a description document

Source: Internet
Author: User

The first method:

You can use the Javadoc tool. It can be extracted from the program source code such as classes, methods, member variables and other documents to form an API supporting documentation. However, when writing code, it is necessary to comment on certain specifications. The development documentation for the code can be generated at the same time through the Javadoc implementation tool. The Javadoc tool is located under the C:\Program files\java\jdk1.6.0_10\bin path.

Where/**...*/this annotation is used to support the Javadoc tool, there are also some identification information at the beginning of the @ can be extracted, such as.

Here is an example of using the Stringbuffer.java file in the source code.

Open the Console window and first enter the Stringbuffer.java directory, which is placed in the C drive test directory.

Execute Javadoc Stringbuffer.java

Such as

If the report cannot find the command, verify that the environment variable is configured when the JDK is installed.

The resulting file is as follows.

Open the file and you will see a description document similar to the Java API style.

The second way:

Implemented with Eclipse.

Right-click in the list of items, select Export,
Then in the Export dialog box, select Javadoc under Java, next.
In the Javadoc Generation dialog box:
Javadoc command: You should select Javadoc.exe in the JDK bin directory
Destination: The save path for the generated document.
Finish commits to start generating the document.

Welcome to visit my blog

How Java extracts comments from a program to generate a description document

Related Article

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.