How to add package level comments in Javadoc? [duplicate]
Solution 1:
Package-level javadoc comments are placed in a file named package-info.java
inside the package directory. It contains the comment and a package declaration:
/**
* Provides the classes necessary to create an applet and the classes an applet uses
* to communicate with its applet context.
* <p>
* The applet framework involves two entities:
* the applet and the applet context. An applet is an embeddable window (see the
* {@link java.awt.Panel} class) with a few extra methods that the applet context
* can use to initialize, start, and stop the applet.
*
* @since 1.0
* @see java.awt
*/
package java.lang.applet;
This is documented here: Package Comment Files
Solution 2:
- Create a file
package-info.java
in your package to document - Add the package descriptor
- Add a comment (/** ...*/) before the package declaration
The following link provides more information: http://docs.oracle.com/javase/specs/jls/se5.0/html/packages.html
It is recommended that package-info.java, if it is present, take the place of package.html for javadoc and other similar documentation generation systems
Package wide annotations will also be declared at package-info.java
Greetz, GHad
Solution 3:
You have to make a package.html
page located within the package. You can read about the contents and structure of this file on the How to Write Doc Comments for the Javadoc Tool page.
Solution 4:
There are two ways of adding package level documentation using javadoc:
- package-info.java
- Only from 5.0
- Preferred way
- Can contain a package declaration, package annotations, package comments and Javadoc tags
- package.html
- Any Java version
- Can not contain package declaration and/or package annotations
More details and examples are here. Which one to use: Javadoc: package.html or package-info.java
Solution 5:
Google found this as the first hit:
http://www.oracle.com/technetwork/java/javase/documentation/index-137868.html#packagecomments
You just create a file named package.html in each package.