Search code examples
javanetbeanspackagejavadoc

Create javadoc at the package level Netbeans


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?


Solution

  • 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;