Skip to content

Instantly share code, notes, and snippets.

@nbhusare
Created May 23, 2019 02:21
Show Gist options
  • Save nbhusare/c7837b7cf341b582c6d16ba9a78d7878 to your computer and use it in GitHub Desktop.
Save nbhusare/c7837b7cf341b582c6d16ba9a78d7878 to your computer and use it in GitHub Desktop.
private static ClassLoader getBundleClassLoader(String name) {
Bundle bundle = Platform.getBundle(name);
BundleWiring wiring = bundle.adapt(BundleWiring.class);
wiring != null : String.format("Should not happen; current state of bundle %s is %s",
bundle.getSymbolicName(), bundle.getState());
return wiring.getClassLoader();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment