/** * Same behavior as in {@link URLClassLoader#loadClass(String, boolean)}, except loading from parent. */ @Override protected synchronized Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException { // First, check if the class has already been loaded Class<?> c = findLoadedClass(name); if (c == null) { try { // Load from parent if ((getParent() != null) && canLoadFromParent(name)) { c = getParent().loadClass(name); } else { // Load from system c = getSystemClassLoader().loadClass(name); } } catch (ClassNotFoundException e) { // If still not found, then invoke findClass in order // to find the class. c = findClass(name); } } if (resolve) { resolveClass(c); } return c; }