/** * Loads a class. If the context class loader is set, it is used. */ public static Class<?> loadClass(String className) throws ClassNotFoundException { ClassLoader ccl = Thread.currentThread().getContextClassLoader(); if (ccl == null) { try { return loadClass(className, null); } catch (ClassNotFoundException cnf) { return loadClassWithRegisteredClassLoaders(className); } } try { return loadClass(className, ccl); } catch (ClassNotFoundException cnf) { try { return loadClass(className, null); } catch (ClassNotFoundException cnf2) { return loadClassWithRegisteredClassLoaders(className); } } }
/** * Loads a class. If the context class loader is set, it is used. */ public static Class<?> loadClass(String className) throws ClassNotFoundException { ClassLoader ccl = Thread.currentThread().getContextClassLoader(); if (ccl == null) { try { return loadClass(className, null); } catch (ClassNotFoundException cnf) { return loadClassWithRegisteredClassLoaders(className); } } try { return loadClass(className, ccl); } catch (ClassNotFoundException cnf) { try { return loadClass(className, null); } catch (ClassNotFoundException cnf2) { return loadClassWithRegisteredClassLoaders(className); } } }