Java Class Loader getClassLoaders(ClassLoader baseClassLoader)

Here you can find the source of getClassLoaders(ClassLoader baseClassLoader)

Description

get Class Loaders

License

Apache License

Declaration

private static Collection<URLClassLoader> getClassLoaders(ClassLoader baseClassLoader) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.net.URLClassLoader;
import java.util.*;

public class Main {
    private static Collection<URLClassLoader> getClassLoaders(ClassLoader baseClassLoader) {
        Collection<URLClassLoader> loaders = new ArrayList<URLClassLoader>(8);
        ClassLoader loader = baseClassLoader;
        while (loader != null) {
            if ("sun.misc.Launcher$ExtClassLoader".equals(loader.getClass().getName())) {
                break;
            }//  w ww  . ja v a 2 s .  c  o  m
            if (loader instanceof URLClassLoader) {
                loaders.add((URLClassLoader) loader);
            }
            loader = loader.getParent();
        }
        return loaders;
    }
}

Related

  1. getClassLoader(File[] directories)
  2. getClassLoader(String path)
  3. getClassLoaderForClass(final Class clazz)
  4. getClassLoaderForDirectory(final File baseFolder)
  5. getClassloaderRootDir(Class forClass)
  6. getClassLoaderStack(ClassLoader cl)
  7. getClassLocation(Class clazz)
  8. getClassLocation(String className)
  9. getCustomClassloader(List entries)