Bundles can use code that is defined within other bundles by declaring the packages as imported packages in the manifest file. Although you can create a bundle that does not rely on any classes other than the Java
™ base packages, most bundles import code from other bundles or the base runtime class path.
You must import any class that you use within a bundle that is not defined in the bundle or that is not a base Java
class, meaning classes within packages that begin with java.
. To import another class, include an import clause for the class's package in the bundle's manifest. You can explicitly import only whole packages; individual classes cannot be explicitly imported.
A bundle can make the classes the bundle defines available to other bundles by exporting packages. To enable other bundles to access a particular package, include an export clause for the package in the manifest of the bundle that contains the package.
Parent topic: Creating OSGi bundles