can any body please tell me how to create package-info.java file in netbeans,when i am trying to create a new java file with name package-info to specify a package level annotation,class name is not valid error is thrown
Thanks in advance
Creating a package-info file is fairly simple: we can create it manually or seek IDE help for generating the same. In IntelliJ IDEA, we can right-click on the package and select New-> package-info. java: Eclipse's New Java Package option allows us to generate a package-info.
The package-info. java is a Java file that can be added to any Java source package. It is used to provide info at a "package" level as per its name. It contains documentation and annotations used in the package.
package-info. java is a way to apply java annotations at the package level. In this case Jaxb is using package-level annotations to indicate the namespace, and to specify namespace qualification for attributes (source).
A package is a namespace that organizes a set of related classes and interfaces. Conceptually you can think of packages as being similar to different folders on your computer. You might keep HTML pages in one folder, images in another, and scripts or applications in yet another.
The package-info.java is not exactly a java source file.
The proper way is, when you create a new file, do not create a Java Class file. Instead, create a Java Package Info file, also in the Java category. This will trigger the New Java Package Info wizard.
That's not completely correct. You can create a file under Other > Other > Empty File with name package-info.java
You can place there the Javadoc comments for the package and the "package" line:
/**
* Here are some comments about this package.
* Here is a comment linking to {@link java.lang.Object}.
*/
package packagename;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With