/** * Adds additional file or path to classpath during runtime. * * @see #addUrlToClassPath(java.net.URL, ClassLoader) */ public static void addFileToClassPath(File path, ClassLoader classLoader) { try { addUrlToClassPath(FileUtil.toURL(path), classLoader); } catch (MalformedURLException muex) { throw new IllegalArgumentException("Invalid path: " + path, muex); } }
/** @see #findClass(String, java.net.URL[], ClassLoader) */ public static Class findClass(String className, File[] classPath, ClassLoader parent) { URL[] urls = new URL[classPath.length]; for (int i = 0; i < classPath.length; i++) { File file = classPath[i]; try { urls[i] = FileUtil.toURL(file); } catch (MalformedURLException ignore) { } } return findClass(className, urls, parent); }