Generate javadoc only with JRE

The command that generates the java docs is actually called javadoc and it is only available with the JDK.


You can use a product called doxygen. It is typically used to create documentation for C++ or other languages that don't have a javadoc product built-in.

You can set up doxygen to read the javadoc annotations and product similar output to javadoc.


Get the source of the JavaDoc from the OpenJDK, and build your own JAR from it with all the relevant JavaDoc classes. Write a maven plugin that relies on your JAR, and call com.sun.tools.javadoc.Main.main from it.

It does not look like you need to open up your sources when using OpenJDK's classes, you should be OK to distribute the resultant plug-in without harsh restrictions.

Even if the terms do not cover the tools, you could write an Open Source GPL-2 plugin for maven, and make it a separate product that you distribute under GPL-2. Your product would then download and install the plugin using maven plugin:download, thus separating out your JavaDoc plugin from the rest of your code.

Of course you should run this suggestion by your legal department before following this advice.


  1. An aside (not answering your Q directly):

    The Eclipse Development Guide recommends using both the Eclipse compiler and the JDK tool (for the javadoc menu option).

    http://help.eclipse.org/juno/index.jsp?topic=%2Forg.eclipse.jdt.doc.user%2Freference%2Fref-export-javadoc.htm

    Eclipse Generate Javadoc Wizard: what is "Javadoc Command"?

    From your comments, it's clear you don't want to go this way, which is your right :)

  2. Answer to your Q. There a few open source / free javadoc tools that you can invoke from your build tool:

    • Major

      • Doxygen

        Doxygen vs Javadoc
        http://doodleproject.sourceforge.net/mavenite/doxygen-maven-plugin/

      • Docflex Doclet (requires JDK)

        http://www.filigris.com/print.php?printfile=/products/docflex_javadoc/docs/integrations.php#maven_2.2.x_3.0.x

    • Minor

      • Javadoc2Help

        (create your own maven command/plugin?)

      • Javadoq

        (create your own maven command/plugin?)

    Pros: Work outside of JDK. Some have richer documentation than javadoc.
    Cons: Might have some non-standard behaviour compared to javadoc (might not be an issue for you).