Reputation: 1149
I created a public class under default package and then I exported this class as jar file. I then created a new project and added the jar file from my directory as a library in my new project.
My problem is, why the class in the jar file cannot be accessed outside the default package ? As shown in the screen shot there is an error in my test.java class under test package when I try to access the class from the jar file.
Any solution to this problem?
Thank you
Upvotes: 2
Views: 1246
Reputation: 44854
You can not access classes in the default package from a named package.
Prior to J2SE 1.4 you could import classes from the default package using a syntax like this:
import Unfinished;
This is no longer allowed
See https://bugs.openjdk.java.net/browse/JDK-6975015
Upvotes: 4