public static void getClassLoaderClasspath(ClassLoader loader, LinkedHashSet<URL> classpath) {
if (loader == null || loader == ClassLoader.getSystemClassLoader()) {
return;
} else if (loader instanceof MultiParentClassLoader) {
MultiParentClassLoader cl = (MultiParentClassLoader)loader;
for (ClassLoader parent : cl.getParents()) {
getClassLoaderClasspath(parent, classpath);
}
for (URL u : cl.getURLs()) {
classpath.add(u);
}
} else if (loader instanceof URLClassLoader) {
URLClassLoader cl = (URLClassLoader)loader;
getClassLoaderClasspath(cl.getParent(), classpath);
for (URL u : cl.getURLs()) {
classpath.add(u);
}
} else {
getClassLoaderClasspath(loader.getParent(), classpath);
}