Just in case you weren't aware both Apache Ant and Apache Maven are tools that exist to accomplish a similar goal to what you are writing (compiling without an IDE).
Both of them have built in support for generating javadoc. Ant syntax looks like this:
<!-- publish javadoc --> <target name="javadoc" description="Creates javadoc for IMP."> <delete dir="${web-javadoc}"/> <javadoc sourcepath="${source}" defaultexcludes="no" destdir="${web-javadoc}" author="true" version="true" use="true" windowtitle="IMP: Integrated Mechanisms Program" overview="${source}/overview.html" classpathref="debug.classpath" stylesheetfile="${javadoc-theme}/stylesheet.css" /> <copy file="${javadoc-theme}/javadoc.jpg" tofile="${web-javadoc}/javadoc.jpg"/> </target>
If you really want to generate it on your own you want to use the Doclet API
import com.sun.javadoc.*; public class ListClass { public static boolean start(RootDoc root) { ClassDoc[] classes = root.classes(); for (int i = 0; i < classes.length; ++i) { System.out.println(classes[i]); } return true; } }