0

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?

IAmYourFaja
  • 55,468
  • 181
  • 466
  • 756
  • Not sure why the downvote - I'd be interested to know this myself! – IAmYourFaja May 15 '12 at 22:14
  • 1
    ... or the [DocLava documentation](http://code.google.com/p/doclava/wiki/GettingStarted)? – Greg Kopff May 15 '12 at 22:19
  • The link you provided does not answer my question. If it does, please show me where and I will happily delete this question myself! These links show you **how to use** Javadoc and DocLava, but they do not explain **how they work under the hood**. Big difference there! – IAmYourFaja May 15 '12 at 22:19
  • 1
    you really don't know how to read for comprehension? [`-doclet`](http://docs.oracle.com/javase/1.5.0/docs/tooldocs/windows/javadoc.html#doclet) answers how to specify an implemenation; @GregKopff shows you an even more specific explict example. If you want to know how they work; which is very well documented by Oracle/Sun and very much out of scope here and that isn't enought, then the `source` is available for everything you ask about. –  May 15 '12 at 22:21
  • I am absolutely comprehension when I read! Explicit examples or not, javadoc is **not** -doclet, no matter how hard you try. – IAmYourFaja May 15 '12 at 22:23
  • 1
    @herpylderp: Your question says: "how does one specify a different Doclet impl over the default?" - and the answer is via the `-doclet` argument to the `javadoc` tool. (The answer being obvious if you read either the javadoc or doclava documentation - they wouldn't be good tools if they didn't tell you how to use them). If your question is really, *how do I build my own doclet implementation*, then that's a different question, and one you didn't ask (or, certainly not clearly). – Greg Kopff May 15 '12 at 22:28
  • That makes sense Greg - if you make that into an answer I'll happily check it green. – IAmYourFaja May 15 '12 at 22:46
  • @herpylderp: see answer below. – Greg Kopff May 17 '12 at 08:46

1 Answers1

4

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}
Greg Kopff
  • 15,945
  • 12
  • 55
  • 78