参考文档:
https://www.codelast.com/%E5%8E%9F%E5%88%9B-java%E5%8A%A8%E6%80%81%E6%B7%BB%E5%8A%A0%E4%B8%80%E4%B8%AA%E7%9B%AE%E5%BD%95%E5%88%B0classpath%E4%B8%AD/
public static loadFoldertoClasspath(){ File programRootDir = new File("./"); URLClassLoader classLoader = (URLClassLoader) ClassLoader.getSystemClassLoader(); Method add = URLClassLoader.class.getDeclaredMethod("addURL", new Class[]{URL.class}); add.setAccessible(true); add.invoke(classLoader, programRootDir.toURI().toURL()); }
标签:URLClassLoader,E5%,classpath,add,88%,E4%,B8%,目录,加载 From: https://www.cnblogs.com/ezgod/p/17778763.html