How to use Javadoc in Intellijidea

Source: Internet
Author: User
Tags locale

IntelliJ Idea 12.1.6 itself provides a good JavaDoc generation function, as well as the standard JavaDoc annotation conversion function, which is essentially in the code writing process, according to the standard JAVADOC annotation requirements, for the need to expose to the user's class, Method and other members to write comments. It then uses the idea's function to automatically call Javadoc.exe (the JDK's own tool) to automatically generate the Javadoc document (in hypertext format) based on the comment content in the source code. Here are a few things to pay special attention to:

  1. Idea's JavaDoc build function is inside the menu Tools->generate JAVADOC item.

  2. When you click on the menu item above, the Generate JavaDoc dialog will appear, the general options are very intuitive, do not need to elaborate. However, it is important to pay attention to the selection of the source code object for generating JavaDoc, which is generally based on module, which can select the necessary Java source code files separately, and does not recommend the source scope generated by PRoject for JavaDoc.

  3. There is a Locale optional fill, that is the need to generate the JAVADOC in which language version to show, according to Javadoc.exe's help, this actually corresponds to Javadoc.exe-locale parameters, if not filled, The default may be English or the current operating system of the language, since it is the Chinese, it is recommended to fill in zh_cn, so that the generation of JAVADOC is the English version, of course, refers to the JAVADOC framework of the various common fixed display areas are Chinese. The content of the comments you write yourself is still based on what you're commenting on.

  4. There is another command line arguments: Optional, it is important to fill in the parameters directly to the Javadoc.exe content. Because there are some important settings, they can only be passed to the Javadoc.exe in the form of direct parameters. The following parameters must be filled in:

    -encoding UTF-8-charset UTF-8-windowtitle "Your document appears in the title bar of the browser window"-link Http://docs.Oracle.com/javase/7/docs/api

  5. The first parameter,-encoding UTF-8, indicates that your source code (which contains comments that conform to the  javadoc standard) is based on UTF-8 encoding, so that non-English characters such as Chinese are garbled during processing; the second parameter-charset UTF-8 Indicates that the character set used to process and generate  javadoc hypertext is also encoded in UTF-8, and currently all browsers support UTF-8, which is most versatile and supports Chinese very well; the third parameter-windowtitle represents the generated JavaDoc When the hypertext is opened in the browser, the text content of the browser window's title bar is displayed, and the fourth parameter-link is very important, which indicates that the JAVADOC you generated involves many references to other external Java classes, whether using fully qualified names or short names with hyperlinks, for example, I have created a method public void func (String arg), which, if the-link parameter is not specified when generating JavaDoc, the representation of the method in JavaDoc automatically becomes public void func (java.lang.String ar g), because the class of String is an externally referenced class for the class I implement, although it is the class of the Java standard library. If the-LINK HTTP://DOCS.ORACLE.COM/JAVASE/7/DOCS/API parameter is specified, Javadoc.exe will use a short name such as String instead of the fully qualified name when generating the Javadoc Java.lang.String, and automatically generates a hyperlink for the short string name, pointing to the official Javase standard document  HTTP://DOCS.ORACLE.COM/JAVASE/7/DOCS/API in the string The detailed document address of the class. -link essentially tells Javadoc.exe to find a text file called Package-list based on the Javadoc address of the provided external reference class, which contains the fully qualified name of all the external reference classes, so the resulting new Javadoc You do not have to use the fully qualified name of an external reference class, you only need to use a short name, and you can automatically create a detailed document hyperlink to its external reference, JAVADOC. Each JAVADOC will have a package-list file in the root directory, including our own generated JavaDoc.

After the JAVADOC is generated, you can find the index.html file in its root directory and open it to see our own standard JAVADOC API documentation.

How to use Javadoc in Intellijidea

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.