1.javadoc
javadoc -help
javadoc的用法: javadoc [options] [packagenames] [sourcefiles] []
最简单的用法:javadoc User.java
2.自定义输出
其中有一条:
-doclet <class> 通过替代 doclet 生成输出
public class DocUtil { private static RootDoc rootDoc = null; public static RootDoc getRootDoc(String classPath) { String[] docArgs = new String[]{ "-doclet", DocUtil.class.getName(), classPath }; com.sun.tools.javadoc.Main.execute(docArgs); return rootDoc; } public static boolean start(RootDoc root) { rootDoc = root; return true; } public static void main(String[] args) { String classPath = "E:\\workspace\\doc\\src\\main\\java\\src\\User.java"; RootDoc rootDoc = getRootDoc(classPath);// com.sun.tools.javadoc.Main.main(new String[]{"javadoc", "E:\\workspace\\doc\\src\\main\\java\\src\\User.java"}); }}
官方文档:http://docs.oracle.com/javase/8/docs/technotes/guides/javadoc/doclet/overview.html#basics