Background: Recently learning Java Fundamentals, see the Documentation Comments section, one is to generate the API files under DOS commands, and the other is to generate API files under Eclipse. Dos in the "Crazy Java Handout" in the detailed description, Eclipse mode because usually use more, so need to summarize.
1 Explanation 1.1 Basics
Javadoc is a technology provided by Oracle that extracts classes, methods, members, and other annotations from the program source code to form an API help document that is compatible with the source code. In other words, as long as the program is written with a set of specific tags as a comment, after the completion of the program, through the Javadoc can form the development of the program document.
Items--Right-click menu Export-->java under Javadoc-->next:
Javadoc command: is to call the Javadoc.exe, without modification, eclipse will find;
Use standard Doclet: is the directory to be generated, customize a folder as the directory [otherwise a lot];
By default you can next--> and next-->
"Note" At this time if the project uses UTF-8 encoding, Extra Javadoc options need to enter the setting parameters, otherwise the generated page Chinese comments are garbled.
-encoding Utf-8-charset Utf-8
Final finish finished.
In the doc directory of the project, there is a Javadoc document.
General Comment Explanation:
@author author name @version version identification @parameter parameters and their meanings @since the earliest use of the method /class/ interface JDK version @return return value @throws Exception class and thrown condition @deprecated cause deprecated warnings @see reference @override override
Reference interfaces and classes:
Package test; /** @author @version */public interface Testface {}
Class:
Packagetest;/*** Test document output <b> Capital Test </b><br> * Line Wrap <br> * Class <code>JavaBlogTest</code> is by Java Cockroach * *@authorJava Cockroach *@version0.0.1 *@since1.5*/ Public classJavablogtestImplementstestface{/**back after stitching to parameters*/ PrivateString back = "_back"; /*** Get a new life *@paramoldstr Old parameters *@returnReturn parameters *@exceptionindexoutofboundsexception If <code>oldStr</code> is null*/ Publicstring Getstr (String oldstr) {returnOldstr +Back ;}}
Operation Steps and Build results:
1.2 Combat
Technical documentation is an important part of the project, andJavadoc is one of the foundations of the Java technical documentation. Javadoc generates a set of easy-to-use API documentation for Java code as a communication tool that provides helpful help for team members to understand the work being done by other members.
Of course, to get good Javadoc documentation requires a well-written and meaningful comment in the source code, which is a demanding requirement for any tool. This is not the main content of this article.
This article details the steps and common issues for exporting a project's Javadoc document using the Eclipse development tool.
Eclipse Export Document action steps
According to the specification of the Javadoc document, the class, interface and other files in the project are carefully written and commented .
Select the project you want to generate Javadoc , and right-click ->export ( export ). Select java->javadocand click next>.
Select the options below and click Next.
Javadoc command : sets the path to Javadoc commands.
Select types for which Javadoc 'll be generated: Select the project you want to build
Create Javadoc for visibility: Select the access scope of the class and method that generated the document.
Destination: Select the destination directory for the generated document.
In documenet title , fill in the name of the generated document, other choices default, click Next.
In the VM options, fill in the -encoding utf-8-charset utf-8, Specific coding methods, depending on your project
The encoding method is determined. Click Finish.
Note: If the encoding method is not correct, there will be an error encoding errors!!!
Then there is the Eclipse build document.
A collection of errors that may occur
export android When the project appeared android.os package does not exist, such as error, &NBSP;
find android< Span class= "Textrun SCX4778437" > jar package. project Mail ->property->java build path->< Span class= "Textrun SCX4778437" >order and Export Select one of the To import the package to resolve this issue. &NBSP;
When generating the document, when the error GBK encoding is invalid, it is because Java uses GBK encoding By default .
In the event of a conflict with your project, this is especially true when exporting Chinese documents, and in creating a document, note the -encoding utf-8-charset utf-8 in the VM options. This problem can be resolved.
(GO) JDK tool-javadoc command