List of utility methods to do Class Load
Class> | loadClass(String className) load Class ClassLoader loader = Thread.currentThread().getContextClassLoader();
return loadClass(className, loader);
|
Class> | loadClass(String className) load Class try { return Class.forName(className); } catch (ClassNotFoundException e) { throw new RuntimeException("Unexpected ClassNotFoundException loading class '" + className + "'"); } catch (NoClassDefFoundError e) { return null; |
Class> | loadClass(String className) load Class try { return Thread.currentThread().getContextClassLoader().loadClass(className); } catch (ClassNotFoundException e) { try { return Class.forName(className); } catch (ClassNotFoundException ex) { try { return ClassLoader.class.getClassLoader().loadClass(className); ... |
Class> | loadClass(String className) load Class Class<?> result = null; if (className != null) { ClassLoader cl = Thread.currentThread().getContextClassLoader(); result = (cl != null ? cl.loadClass(className) : null); return result; |
Class | loadClass(String className) load Class return getDefaultClassLoader().loadClass(className);
|
Class> | loadClass(String className) Load the class try { return Class.forName(className); } catch (ClassNotFoundException e) { throw new IllegalStateException(e); |
Class | loadClass(String className) load Class return loadClass(className, getContextClassLoader());
|
Class> | loadClass(String className) Load class from the previously set class loader. ClassLoader loader = currentClassLoader; if (loader == null) { loader = Thread.currentThread().getContextClassLoader(); try { return Class.forName(className, false, loader); } catch (ClassNotFoundException e) { ClassLoader contextLoader = Thread.currentThread().getContextClassLoader(); ... |
Class | loadClass(String className) Loads a class with the given name. Class<T> clazz = null; try { clazz = (Class<T>) Thread.currentThread().getContextClassLoader().loadClass(className); } catch (ClassNotFoundException nf) { clazz = (Class<T>) Class.forName(className); return clazz; |
Class> | loadClass(String className) Load the specified class, which can be a (public static) inner class provided the physical name is used ("my.package.MyClass$MyInnerClass") rather than the canonical name ("my.package.MyClass.MyInnerClass") ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
return classLoader.loadClass(className);
|