views:

465

answers:

4

In the Java APIs I can see Javadoc comments for packages.

How/where do I place Javadoc comments to document a package?

+3  A: 

With a package.html file at the package level (i.e. in the directory for that package). This should be a fully-formed HTML file, with the <html> tag defined in it

oxbow_lakes
More details? What should the file look like?
jjnguy
It's an HTML file containing the description of your package. That's it!
oxbow_lakes
+3  A: 

I believe that this is the specific answer to your question.

Glenn
+1: Quote the documentation
S.Lott
+6  A: 

Until Java 1.4, you had to provide a HTML file package.html, as described in the other answers.

Since Java 1.5 you can also provide a package-info.java, which contains a regular Javadoc comment (no HTML). The latter is preferred, as it gives you some extra features (notably package annotations).

Details: Sun's docs for javadoc

sleske
It's package-info.java
banjollity
+1 for mentioning both ways, and the essential difference between them. By the way, at least IntelliJ IDEA currently has better support for package.html (Ctrl-Q on a package name shows the package Javadocs).
Jonik
Thanks, fixed package.java to read package-info.java
sleske
+16  A: 

As of 1.5 you can define a package-info.java file and provide a standard javadoc style comment for a package:

com/foo/package-info.java:

/**
 * com.foo is a group of bar utils for operating on foo things.
 */
package com.foo;

//rest of the file is empty

Packages reference (it's in there somewhere)

Gareth Davis
Thanks for some code examples.
jjnguy