Suzan Cioc
Suzan Cioc

Reputation: 30097

Where to put java package-level information to use by javadoc?

Some API docs contain information at package level. For example java.io contains 3 package-level sections here http://docs.oracle.com/javase/7/docs/api/java/io/package-summary.html

The sections are: "Package java.io Description", "Package Specification" and "Related Documentation".

Where should I put these sections content in my own project so that javadoc processes it in the same way?

Upvotes: 5

Views: 1548

Answers (3)

Joachim Sauer
Joachim Sauer

Reputation: 308011

You put those comments in a package comment file (emphasis mine):

Each package can have its own documentation comment, contained in its own "source" file, that the Javadoc tool will merge into the package summary page that it generates. You typically include in this comment any documentation that applies to the entire package.

To create a package comment file, you have a choice of two files to place your comments:

  • package-info.java - Can contain a package declaration, package annotations, package comments and Javadoc tags. This file is generally preferred over package.html .
  • package.html - Can contain only package comments and Javadoc tags, no package annotations.

Upvotes: 2

Pao
Pao

Reputation: 843

You have to put a file called package-info.java into the folder that contains your package.

Upvotes: 1

peshkira
peshkira

Reputation: 6229

create a file called package-info.java in each package

inside do the following

/**
 * Javadoc
 */
package my.cool.package123;

Upvotes: 6

Related Questions