-
-
Save ansell/1945491 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 static class CompositeClassLoader extends ClassLoader { | |
private Vector<ClassLoader> classLoaders = new Vector<ClassLoader>(); | |
@Override | |
public URL getResource(String name) { | |
for (ClassLoader cl : classLoaders) { | |
URL resource = cl.getResource(name); | |
if (resource != null) | |
return resource; | |
} | |
return null; | |
} | |
@Override | |
public Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException { | |
for (ClassLoader cl : classLoaders) { | |
try { | |
return cl.loadClass(name); | |
} catch (ClassNotFoundException ex) { | |
} | |
} | |
throw new ClassNotFoundException(name); | |
} | |
public void addClassLoader(ClassLoader cl) { | |
classLoaders.add(cl); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment