3

OK. There appears to be lots of information out there on how to do this but I'm not getting the information in my javadoc for the package description. Plus, I'm a little (or a lot) confused about the exact procedure on how to do this.

I've created a package-info.java class as specified in this answer.

/*
 * Package description that I want to get added to my javadoc
 */
package com.pdl.myapp;

But when I run generate javadocs nothing appears in the description for the package in the javadocs.

enter image description here

Then I tried using package level annotations as described in this answer but got very confused about exactly what to put to replace the // stuff as required.

Here is my package-info.java class. Notice the @PackageLevelAnnotation annotation has been added.

/*
 * Package description that I want to get added to my javadoc
 */
@PackageLevelAnnotation
package com.pdl.myapp;

Here is my

package com.pdl.myapp;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 *
 * @author Miss Lucy
 */
@Retention(RetentionPolicy.CLASS)
@Target(ElementType.PACKAGE)
public @interface PackageLevelAnnotation {
    // stuff as required  <----- WHAT IS THIS?
    // How do I add my package description?
    // Package description that I want to get added to my javadoc
}

Call me dumb but I am just not getting it. Can someone give me specific information or point me to this topic for Dummies?

1 Answer 1

4

It looks like you are using the wrong comment style.

/* <--- note one asterisk.
 * You are using this, this does not generate java docs.
 */

In your package-info.java file include a java doc comment above the package. For example:

 /** <--- note two asterisks.
  * This is my package description
  */
 package com.blam.kapow;
Sign up to request clarification or add additional context in comments.

4 Comments

Please where is the package-info.java file located? 😁
Every package may contain a package-info.java file; it is located in the package.
Thanks! I know IDEs like InteliJ, Eclipse and NetBeans has an option that automatically does it for us under a menu, but unlucky for me because I haven't installed any yet so I'm using NotePad++ to code so I have to do things manually and understand after viewing this link github.com/eugenp/tutorials/tree/master/core-java-modules/…
"located in the package" in java terms translates to "located in the directory that represents the package on the disk"

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.