in tools/erlanalysis/src/main/java/org/apache/dubbo/erlang/analysis/parse/InterfaceParse.java [60:88]
private boolean loadDependencyJar(String rootPath) {
File jarPathFile = new File(rootPath);
if (!jarPathFile.exists() || jarPathFile.isFile()) {
logger.error("load dependency error target dir unexist {}", rootPath);
return false;
}
List urlList = new ArrayList<URL>();
File[] fileList = jarPathFile.listFiles();
for (int i = 0; i < fileList.length; i++) {
File item = fileList[i];
if (item.isDirectory()) {
continue;
}
try {
if (item.getAbsolutePath().endsWith(".jar")) {
urlList.add(item.toURI().toURL());
logger.debug("url class load add lib {}", item.getAbsolutePath());
}
} catch (MalformedURLException e) {
logger.error("get jar list error ", e);
}
}
URL[] urls = new URL[urlList.size()];
urlList.toArray(urls);
URLClassLoader cl = new URLClassLoader(urls, Thread.currentThread().getContextClassLoader());
Thread.currentThread().setContextClassLoader(cl);
return true;
}