How to get classloader for a bundle in equinox?

Suraj Chandran picture Suraj Chandran · Oct 1, 2009 · Viewed 15.3k times · Source

I have read a lot of equinox code for this, but still can't figure out a non-hacky way of getting the classloader for a osgi bundle in eclipse equinox setup. Is there one?

Answer

Balazs Zsoldos picture Balazs Zsoldos · Mar 7, 2013

In OSGi 4.3 you can use:

bundle.adapt(BundleWiring.class).getClassLoader()