Reputation: 1091
Is it possible to access only few packages from jar file, and for remaining packages we can hide from them for accessing from jar file.
For instance,
I want to access classes from p1 package and hide all other classes of p2 and p3 package from jar file. While classes in p2 and p3 are public and are implemented in classes from p1 package?
Upvotes: 2
Views: 141
Reputation: 38142
You will need some module system to reach this goal, eg.
Upvotes: 1
Reputation: 18123
No this is not possible with default JAR file. You have two options:
internal
and document in such a way that client will not use, in document mention like "Classes under this package can change at any time" so clients won't use it, just like JDK does.OSGi
which helps for your requirements. More info hereUpvotes: 2