Some sun.misc internal APIs are deprectaed in JDK 9 and will be encapsulated or removed in a future release.
public CommonURLClassLoader(URL[] urls) { super(urls); this.urlClasspath = new URLClassPath(urls); }
public CommonURLClassLoader(URL[] urls, ClassLoader parent, URLStreamHandlerFactory factory) { super(urls, parent, factory); this.urlClasspath = new URLClassPath(urls); }
public CommonURLClassLoader(URL[] urls, ClassLoader parent) { super(urls, parent); this.urlClasspath = new URLClassPath(urls); }
/** * Creates a new EnhancerClassLoader for the specified url. * * @param urls the classpath to search */ protected EnhancerClassLoader(URL[] urls, ClassLoader loader) { super(urls, loader); acc = AccessController.getContext(); ucp = new URLClassPath(urls); checkUCP(urls); }
private static void givePriorityInClasspath(URL url, URLClassLoader classLoader) { try { Field ucpField = URLClassLoader.class.getDeclaredField("ucp"); ucpField.setAccessible(true); List<URL> urls = new ArrayList<>(Arrays.asList(classLoader.getURLs())); urls.remove(url); urls.add(0, url); URLClassPath ucp = new URLClassPath(urls.toArray(new URL[0])); ucpField.set(classLoader, ucp); } catch (ReflectiveOperationException e) { throw new AssertionError(e); } }
/** * Creates a new EnhancerClassLoader for the specified url. * * @param urls the classpath to search */ protected EnhancerClassLoader(URL[] urls) { super(urls); acc = AccessController.getContext(); ucp = new URLClassPath(urls); checkUCP(urls); }
public ClasspathTypeLoader(final String classPath) { final String[] parts = VerifyArgument.notNull(classPath, "classPath") .split(Pattern.quote(System.getProperty("path.separator"))); final URL[] urls = new URL[parts.length]; for (int i = 0; i < parts.length; i++) { try { urls[i] = new File(parts[i]).toURI().toURL(); } catch (MalformedURLException e) { throw new UndeclaredThrowableException(e); } } _classPath = new URLClassPath(urls); }
public ClasspathTypeLoader(final String classPath) { final String[] parts = VerifyArgument.notNull(classPath, "classPath") .split(Pattern.quote(System.getProperty("path.separator"))); final URL[] urls = new URL[parts.length]; for (int i = 0; i < parts.length; i++) { try { urls[i] = new File(parts[i]).toURI().toURL(); } catch (MalformedURLException e) { throw new UndeclaredThrowableException(e); } } _classPath = new URLClassPath(urls); }
ClassPool pool = ClassPool.getDefault(); ClassPath cp = new URLClassPath("www.javassist.org", 80, "/java/", "org.javassist."); pool.insertClassPath(cp);