I have been working with OSGi for a while now, but I still don't understand something about private packages.
Aren't all bundle packages which are not exported invisible to all other packages? If so, what's the difference to private packages and packages which are not exported?
I've read OSGi in Action and "OSGi and Apache Felix 3.0 - Beginners Guide", but i was not able to find the difference.
There is no difference.
Any package which is not listed in Export-Package
is private.... that's all there is to it.
You may have seen another header called Private-Package
. This is NOT an OSGi header and it is completely ignored by the OSGi Framework. If you see this it indicates that a bundle has been built with bnd or the Maven Bundle Plugin, which uses this header has a build-time instruction. It's therefore only relevant at build time, and has no effect whatsoever at run time.