You can modify the startup osgi. parentclassloader to change this parent classloaer. The default value is boot.
Optional values include app, ext, and fwk.
Systemclassloader corresponding to the app. That is, the system class loader.
EXT corresponds to the parent of systemclassloader, that is, the extended class loader.
Fwk corresponds to the classloader that starts equinox.
You can see the following code in org. Eclipse. osgi. baseadaptor. baseadaptor:
// System property used to set the parent classloader type (boot is the default)
Private Static final string prop_parent_classloader = "osgi. parentclassloader"; // $ NON-NLS-1 $
// A parent classloader type that specifies the application classloader
Private Static final string parent_classloader_app = "app"; // $ NON-NLS-1 $
// A parent classloader type that specifies the extension classlaoder
Private Static final string parent_classloader_ext = "Ext"; // $ NON-NLS-1 $
// A parent classloader type that specifies the boot classlaoder
Private Static final string parent_classloader_boot = "Boot"; // $ NON-NLS-1 $
// A parent classloader type that specifies the framework classlaoder
Private Static final string parent_classloader_fwk = "fwk"; // $ NON-NLS-1 $
// The bundleclassloader parent to use when creating bundleclassloaders.
Private Static classloader bundleclassloaderparent;
Static {
// Check property for specified parent
String type = frameworkproperties. getproperty (baseadaptor. prop_parent_classloader, baseadaptor. parent_classloader_boot );
If (baseadaptor. parent_classloader_fwk.equalsignorecase (type ))
Bundleclassloaderparent = frameworkadaptor. Class. getclassloader ();
Else if (baseadaptor. parent_classloader_app.equalsignorecase (type ))
Bundleclassloaderparent = classloader. getsystemclassloader ();
Else if (baseadaptor. parent_classloader_ext.equalsignorecase (type )){
Classloader appcl = classloader. getsystemclassloader ();
If (appcl! = NULL)
Bundleclassloaderparent = appcl. getparent ();
}
// Default to boot classloader
If (bundleclassloaderparent = NULL)
Bundleclassloaderparent = new parentclassloader ();
}
// Empty parent classloader. This is used by default as the bundleclassloader parent.
Private Static class parentclassloader extends classloader {
Protected parentclassloader (){
Super (null );
}
}
Modify the configuration. You can do a small experiment debugging in eclipse.
Run invocations ---> arguments000> VM arguments
For example, add:
-Dosgi. parentclassloader = ext