The system bundle is a special bundle that represents the OSGi framework itself, from within that framework. It has the following roles:
- Exports packages from the JRE (excluding
java.*
), for examplejavax.swing
,org.w3c.com
etc. - Exports the OSGi framework packages such as
org.osgi.framework
. - Stopping the system bundle has the effect of shutting down the OSGi framework.
- Updating the system bundle has the effect of restarting the OSGi framework (requires support from the launcher).
The system bundle always has a bundle id of 0 (zero), so in code we can safely obtain a reference to it as follows:
Bundle systemBundle = context.getBundle(0);