The default package '.' is not permitted by the Import-Package syntax
12,515
Solution 1
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
Solution 2
From what I understand about the OSGi library .class files are where they shouldn't be b/c the way this library is structured there are deps in the root package.
Looking at this blog yields more detail.
Solution 3
I did fix after remove "classes", "obr" and "\container\tomcat8x\cargo-confluence-home" folder inside "target" then only run atlas-package
Author by
Peter
Updated on June 09, 2022Comments
-
Peter about 2 years
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
-
Peter over 8 yearsThis bundle has 143 Bundle's under it's dependencies declaration, it does not use the JDom too...
-
coderrick over 8 yearsI know that the particular example shown in the blog uses JDom, but essentially you have the same issue. There is something wrong with the location of your dependencies. Add more of the error output so its easier to analyze.
-
coderrick over 8 yearsOh you figured it out? NVM but yeah since left over .class files were messing up your build I guess doing "clean install" would fix the problem lol.