List of usage examples for java.net URLClassLoader getURLs
public URL[] getURLs()
From source file:xc.mst.utils.SetupClasspath.java
@SuppressWarnings("unchecked") public static void addURL(URL u) { URLClassLoader sysloader = (URLClassLoader) ClassLoader.getSystemClassLoader(); Class sysclass = URLClassLoader.class; for (URL u2 : sysloader.getURLs()) { // System.out.println("u: "+u2); }//from ww w. ja va 2 s. com try { Method method = sysclass.getDeclaredMethod("addURL", new Class[] { URL.class }); method.setAccessible(true); method.invoke(sysloader, new Object[] { u }); } catch (Throwable t) { t.printStackTrace(); throw new RuntimeException("Error, could not add URL to system classloader"); } }