Doclets vs DocLava

2.5k Views Asked by At

My understanding is:

  • The Java Doclet API is just an API (composed of interfaces) rooted at com.sun.javadoc
  • When Javadoc runs it looks for a Doclet API impl to bind to at runtime
  • If no such impl exists then it uses some default (hence you can generate Javadocs without having to specify your own CSS files, etc.)
  • Google's DocLava is one such Doclet API impl

If this is true, then how does one specify a different Doclet impl (such as DocLava) over the default? If I'm way off base, then how does the Javadoc tool, the Doclet API and DocLava all relate to one another?

1

There are 1 best solutions below

0
On

how does one specify a different Doclet impl (such as DocLava) over the default?

See the javadoc tool documentation command line option section. You specify the document to use with the -doclet argument:

-doclet class

Specifies the class file that starts the doclet used in generating the documentation. Use the fully-qualified name. This doclet defines the content and formats the output. If the -doclet option is not used, javadoc uses the standard doclet for generating the default HTML format. This class must contain the start(Root) method. The path to this starting class is defined by the -docletpath option.

For example, to call the MIF doclet, use:

   -doclet com.sun.tools.doclets.mif.MIFDoclet

For full, working examples of running a particular doclet, see Running the MIF Doclet.

Details about using the DocLava doclet are in the DocLava Getting Started guide:

The command line arguments to pass to Javadoc to use Doclava are:

-doclet com.google.doclava.Doclava
-docletpath ${jar.file}