sun.misc.URLClassPath Java Examples
The following examples show how to use
sun.misc.URLClassPath.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PluginClassLoaderTest.java From sofa-ark with Apache License 2.0 | 6 votes |
@Test public void testSlashResource() throws Throwable { URLClassLoader urlClassLoader = (URLClassLoader) this.getClass().getClassLoader(); Field ucpFiled = URLClassLoader.class.getDeclaredField("ucp"); ucpFiled.setAccessible(true); URLClassPath ucp = (URLClassPath) ucpFiled.get(urlClassLoader); PluginClassLoader pluginClassLoader = new PluginClassLoader("pluginName", ucp.getURLs()); PluginModel mockPlugin = new PluginModel(); mockPlugin.setPluginName("pluginName").setClassPath(new URL[] {}) .setImportResources(StringUtils.EMPTY_STRING) .setImportClasses(StringUtils.EMPTY_STRING).setImportPackages(StringUtils.EMPTY_STRING) .setExportPackages(ClassUtils.getPackageName(ITest.class.getCanonicalName())) .setExportClasses(StringUtils.EMPTY_STRING).setPluginClassLoader(pluginClassLoader); pluginManagerService.registerPlugin(mockPlugin); URL url = pluginClassLoader.getResource(""); Assert.assertNotNull(url); Assert.assertEquals(url, this.getClass().getResource("/")); }
Example #2
Source File: URLClassLoader.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
URLClassLoader(URL[] urls, AccessControlContext acc) { super(); // this is to make the stack depth consistent with 1.1 SecurityManager security = System.getSecurityManager(); if (security != null) { security.checkCreateClassLoader(); } this.acc = acc; ucp = new URLClassPath(urls, acc); }
Example #3
Source File: URLClassLoader.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
URLClassLoader(URL[] urls, ClassLoader parent, AccessControlContext acc) { super(parent); // this is to make the stack depth consistent with 1.1 SecurityManager security = System.getSecurityManager(); if (security != null) { security.checkCreateClassLoader(); } this.acc = acc; ucp = new URLClassPath(urls, acc); }
Example #4
Source File: URLClassLoader.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
URLClassLoader(URL[] urls, ClassLoader parent, AccessControlContext acc) { super(parent); // this is to make the stack depth consistent with 1.1 SecurityManager security = System.getSecurityManager(); if (security != null) { security.checkCreateClassLoader(); } ucp = new URLClassPath(urls); this.acc = acc; }
Example #5
Source File: URLClassLoader.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
URLClassLoader(URL[] urls, ClassLoader parent, AccessControlContext acc) { super(parent); // this is to make the stack depth consistent with 1.1 SecurityManager security = System.getSecurityManager(); if (security != null) { security.checkCreateClassLoader(); } this.acc = acc; ucp = new URLClassPath(urls, acc); }
Example #6
Source File: URLClassLoader.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
URLClassLoader(URL[] urls, AccessControlContext acc) { super(); // this is to make the stack depth consistent with 1.1 SecurityManager security = System.getSecurityManager(); if (security != null) { security.checkCreateClassLoader(); } this.acc = acc; ucp = new URLClassPath(urls, acc); }
Example #7
Source File: URLClassLoader.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
URLClassLoader(URL[] urls, AccessControlContext acc) { super(); // this is to make the stack depth consistent with 1.1 SecurityManager security = System.getSecurityManager(); if (security != null) { security.checkCreateClassLoader(); } ucp = new URLClassPath(urls); this.acc = acc; }
Example #8
Source File: URLClassLoader.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
URLClassLoader(URL[] urls, AccessControlContext acc) { super(); // this is to make the stack depth consistent with 1.1 SecurityManager security = System.getSecurityManager(); if (security != null) { security.checkCreateClassLoader(); } this.acc = acc; ucp = new URLClassPath(urls, acc); }
Example #9
Source File: URLClassLoader.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
URLClassLoader(URL[] urls, AccessControlContext acc) { super(); // this is to make the stack depth consistent with 1.1 SecurityManager security = System.getSecurityManager(); if (security != null) { security.checkCreateClassLoader(); } ucp = new URLClassPath(urls); this.acc = acc; }
Example #10
Source File: URLClassLoader.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
URLClassLoader(URL[] urls, ClassLoader parent, AccessControlContext acc) { super(parent); // this is to make the stack depth consistent with 1.1 SecurityManager security = System.getSecurityManager(); if (security != null) { security.checkCreateClassLoader(); } ucp = new URLClassPath(urls); this.acc = acc; }
Example #11
Source File: URLClassLoader.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
URLClassLoader(URL[] urls, ClassLoader parent, AccessControlContext acc) { super(parent); // this is to make the stack depth consistent with 1.1 SecurityManager security = System.getSecurityManager(); if (security != null) { security.checkCreateClassLoader(); } this.acc = acc; ucp = new URLClassPath(urls, acc); }
Example #12
Source File: URLClassLoader.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
URLClassLoader(URL[] urls, AccessControlContext acc) { super(); // this is to make the stack depth consistent with 1.1 SecurityManager security = System.getSecurityManager(); if (security != null) { security.checkCreateClassLoader(); } this.acc = acc; ucp = new URLClassPath(urls, acc); }
Example #13
Source File: RemoveHandler.java From VersionChecker with GNU Lesser General Public License v3.0 | 5 votes |
@SuppressWarnings("unchecked") public static boolean deleteFile(File file) { if (file.delete()) { return true; } try { ClassLoader cl = RemoveHandler.class.getClassLoader(); URL url = file.toURI().toURL(); Field f_ucp = URLClassLoader.class.getDeclaredField("ucp"); Field f_loaders = URLClassPath.class.getDeclaredField("loaders"); Field f_lmap = URLClassPath.class.getDeclaredField("lmap"); f_ucp.setAccessible(true); f_loaders.setAccessible(true); f_lmap.setAccessible(true); URLClassPath ucp = (URLClassPath) f_ucp.get(cl); Closeable loader = ((Map<String, Closeable>) f_lmap.get(ucp)).remove(URLUtil.urlNoFragString(url)); if (loader != null) { loader.close(); ((List<?>) f_loaders.get(ucp)).remove(loader); } } catch (Exception e) { e.printStackTrace(); } return file.delete(); }
Example #14
Source File: URLClassLoader.java From jdk1.8-source-analysis with Apache License 2.0 | 5 votes |
URLClassLoader(URL[] urls, AccessControlContext acc) { super(); // this is to make the stack depth consistent with 1.1 SecurityManager security = System.getSecurityManager(); if (security != null) { security.checkCreateClassLoader(); } this.acc = acc; ucp = new URLClassPath(urls, acc); }
Example #15
Source File: DepLoader.java From WirelessRedstone with MIT License | 5 votes |
private void deleteMod(File mod) { if (mod.delete()) return; try { ClassLoader cl = DepLoader.class.getClassLoader(); URL url = mod.toURI().toURL(); Field f_ucp = URLClassLoader.class.getDeclaredField("ucp"); Field f_loaders = URLClassPath.class.getDeclaredField("loaders"); Field f_lmap = URLClassPath.class.getDeclaredField("lmap"); f_ucp.setAccessible(true); f_loaders.setAccessible(true); f_lmap.setAccessible(true); URLClassPath ucp = (URLClassPath) f_ucp.get(cl); Closeable loader = ((Map<String, Closeable>) f_lmap.get(ucp)).remove(URLUtil.urlNoFragString(url)); if (loader != null) { loader.close(); ((List<?>) f_loaders.get(ucp)).remove(loader); } } catch (Exception e) { e.printStackTrace(); } if (!mod.delete()) { mod.deleteOnExit(); String msg = owner + " was unable to delete file " + mod.getPath() + " the game will now try to delete it on exit. If this dialog appears again, delete it manually."; System.err.println(msg); if (!GraphicsEnvironment.isHeadless()) JOptionPane.showMessageDialog(null, msg, "An update error has occured", JOptionPane.ERROR_MESSAGE); System.exit(1); } }
Example #16
Source File: URLClassLoader.java From jdk-1.7-annotated with Apache License 2.0 | 5 votes |
URLClassLoader(URL[] urls, AccessControlContext acc) { super(); // this is to make the stack depth consistent with 1.1 SecurityManager security = System.getSecurityManager(); if (security != null) { security.checkCreateClassLoader(); } ucp = new URLClassPath(urls); this.acc = acc; }
Example #17
Source File: URLClassLoader.java From JDKSourceCode1.8 with MIT License | 5 votes |
URLClassLoader(URL[] urls, ClassLoader parent, AccessControlContext acc) { super(parent); // this is to make the stack depth consistent with 1.1 SecurityManager security = System.getSecurityManager(); if (security != null) { security.checkCreateClassLoader(); } this.acc = acc; ucp = new URLClassPath(urls, acc); }
Example #18
Source File: URLClassLoader.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 4 votes |
public URLClassPath getURLClassPath (URLClassLoader u) { return u.ucp; }
Example #19
Source File: ClassLoader.java From Java8CN with Apache License 2.0 | 4 votes |
/** * 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; }
Example #20
Source File: ClazzLoaderFactory.java From jhades with MIT License | 4 votes |
public static ClazzLoader createBootstrapClassLoader() { URLClassPath cp = Launcher.getBootstrapClassPath(); return new UrlClazzLoader(BOOTSTRAP_CLASS_LOADER, "N/A", cp.getURLs()); }
Example #21
Source File: ClassLoader.java From hottub with GNU General Public License v2.0 | 4 votes |
static URLClassPath getBootstrapClassPath() { return sun.misc.Launcher.getBootstrapClassPath(); }
Example #22
Source File: ClassLoader.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 4 votes |
/** * 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; }
Example #23
Source File: URLClassLoader.java From Java8CN with Apache License 2.0 | 4 votes |
public URLClassPath getURLClassPath (URLClassLoader u) { return u.ucp; }
Example #24
Source File: URLClassLoader.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
public URLClassPath getURLClassPath (URLClassLoader u) { return u.ucp; }
Example #25
Source File: ClassLoader.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
/** * 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; }
Example #26
Source File: ClassLoader.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
static URLClassPath getBootstrapClassPath() { return sun.misc.Launcher.getBootstrapClassPath(); }
Example #27
Source File: ClassLoader.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
/** * 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; }
Example #28
Source File: ClassLoader.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
/** * 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; }
Example #29
Source File: ClassLoader.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
static URLClassPath getBootstrapClassPath() { return sun.misc.Launcher.getBootstrapClassPath(); }
Example #30
Source File: ClassLoader.java From JDKSourceCode1.8 with MIT License | 4 votes |
static URLClassPath getBootstrapClassPath() { return sun.misc.Launcher.getBootstrapClassPath(); }