Trying to run @org.junit.Test with Intellij IDEA.
It's an OSGi bundle, when hit Run 'testMyTest'
Getting following exception:
Error:osgi: [b2b-bundle] The default package '.' is not permitted by the Import-Package syntax.
This can be caused by compile errors in Eclipse because Eclipse creates
valid class files regardless of compile errors.
The following package(s) import from the default package null
Could someone kindly share light on this exception?
Thanks, Peter
For convenience, the Java compiler automatically imports two entire packages for each source file: (1) the java. lang package and (2) the current package (the package for the current file).
Import the Specific Class If we use import packagename. classname statement then only the class with name classname in the package will be available for use.
Java compiler imports java. lang package internally by default. It provides the fundamental classes that are necessary to design a basic Java program.
The default package is a collection of java classes whose source files do not contain and package declarations.
You probably didn't place your class inside a package.
Add
package your_package_name;
at the top of your .java file and you should be good.
PS: Depending on your package name, you may need to move the file to some other location as well
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