How to generate java doc

Write the doc in source code

package org.lovian.javadoc

package org.lovian.javadoc;

/**
 * This is a demon class for java doc
 * This is java doc of class
 * @author PENG Zhengshuai
 * @lovian.org
 * @version 0.1
 */
public class HelloWorld {

	/**
	 * These is java doc of methods
	 * @param args
	 */
	public static void main(String[] args) {
		System.out.println("Hello, Javadoc");
	}
}



Use Javadoc tool

Use javadoc tool in terminal to generate the java doc files. You should already have jdk installed.

$ javadoc -d /path/to/directory -author -version HelloWorld.java

Then the java doc files will be generate in the /path/to/directory folder.

Use Eclipse

In Eclipse, right-click the project name, choose Export, find java folder, choose javadoc, click next, choose the destination of your javadoc, then finished.


Share this on