Created
September 14, 2016 07:46
-
-
Save danglotb/25c99bc854067718840efd088c8a03a1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private ClassLoader buildLoader() throws Exception { | |
List<URL> urls = new ArrayList<>(); | |
urls.addAll(((PluginClassLoader) getClass().getClassLoader()).getUrls()); | |
urls.addAll(getParent().getUrls()); | |
return new URLClassLoader(urls.toArray(new URL[urls.size()])); | |
} | |
private UrlClassLoader getParent() throws Exception { | |
Field parents = PluginClassLoader.class.getDeclaredField("myParents"); | |
parents.setAccessible(true); | |
return (UrlClassLoader) ((ClassLoader[]) parents.get((PluginClassLoader) getClass().getClassLoader()))[0]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment