How do I add package level annotations or edit package-info.java?

link_boy picture link_boy · Dec 6, 2011 · Viewed 44.2k times · Source

I'm trying to add package level annotations but I don't have a clue on how to do it. Examples are appreciated.

Answer

javabeangrinder picture javabeangrinder · Feb 5, 2013

In eclipse

Since package-info.java isn't a valid identifier for a class it cannot be created as a class in Eclipse.

I found that when you create a new package there is a check box to check if you want a package-info.java.

To create a package-info.java file in an existing package:

  1. Right-click on the package where you want a package-info.java.
  2. Select New->Package.
  3. Check the Create package-info.java check box.
  4. Click on Finish.