Saturday, May 22, 2010

Javadoc Basic Tutorial

1. Use following comment style to generate a Javadoc.

/**  
 * Returns .............  
 * 
 * @param  url  an absolute URL   
 * @param  name the location of the  
 * @return      the image   
 * @see         Image  
 */
The first line contains the begin-comment delimiter (/**).
The last line contains the end-comment delimiter (*/) Note that unlike the begin-comment delimiter, the end-comment contains only a single asterisk.

Order of Tags
Include tags in the following order:

* @author      (classes and interfaces only, required) 
* @version     (classes and interfaces only, required. See footnote 1) 
* @param       (methods and constructors only) 
* @return      (methods only)
* @exception   (@throws is a synonym added in Javadoc 1.2) 
* @see          
* @since       
* @serial      (or @serialField or @serialData)
2.Click on projects link and choose ” Generate Javadoc ” option.

3.Now a window will be opened where you can select Java Projects or their underlying resources for which JavaDoc needs to be generated. Several other options are also there where user can select any of them as per the need.Here user can select whether to generate JavaDoc for public/private API’s etc.

To Generate the Javadoc you need to have JDK installed. The JRE won't work since it's a compact version so they do not provide the Javadoc functionality.
The Javadoc command will be the Javadoc.exe which is located in the bin folder of the JDK installation.

4.Now IDE asks for other features as well for the generation of Javadoc.

5.You can also save settings as ant script so that you can use the script to generate javadoc in future.

6.Click “Finish” Javadoc will be generated. If you select option of opening index file in browser then after generation of Javadoc you will find ” index.htm ” of Javadoc in your default Web Browser. On console you can see progress of JavaDoc Generation.

No comments:

Post a Comment