use of sun.misc.URLClassPath in project intellij-community by JetBrains.
the class GroovycRunner method buildMainLoader.
@Nullable
private static ClassLoader buildMainLoader(String argsPath) {
Set<URL> bootstrapUrls = new HashSet<URL>();
try {
Method method = ClassLoader.class.getDeclaredMethod("getBootstrapClassPath");
method.setAccessible(true);
URLClassPath ucp = (URLClassPath) method.invoke(null);
Collections.addAll(bootstrapUrls, ucp.getURLs());
} catch (Exception e) {
e.printStackTrace();
}
final List<URL> urls = new ArrayList<URL>();
try {
//noinspection IOResourceOpenedButNotSafelyClosed
BufferedReader reader = new BufferedReader(new FileReader(argsPath));
String classpath = reader.readLine();
for (String s : classpath.split(File.pathSeparator)) {
URL url = new File(s).toURI().toURL();
if (!bootstrapUrls.contains(url)) {
urls.add(url);
}
}
reader.close();
} catch (IOException e) {
e.printStackTrace();
return null;
}
final ClassLoader[] ref = new ClassLoader[1];
new Runnable() {
public void run() {
ref[0] = UrlClassLoader.build().urls(urls).useCache().get();
}
}.run();
return ref[0];
}
use of sun.misc.URLClassPath in project jdk8u_jdk by JetBrains.
the class SystemClassLoaderAction method getBootstrapResource.
/**
* Find resources from the VM's built-in classloader.
*/
private static URL getBootstrapResource(String name) {
URLClassPath ucp = getBootstrapClassPath();
Resource res = ucp.getResource(name);
return res != null ? res.getURL() : null;
}
use of sun.misc.URLClassPath in project intellij-community by JetBrains.
the class SystemClassLoaderAction method getBootstrapResource.
/**
* Find resources from the VM's built-in classloader.
*/
private static URL getBootstrapResource(String name) {
URLClassPath ucp = getBootstrapClassPath();
Resource res = ucp.getResource(name);
return res != null ? res.getURL() : null;
}
Aggregations