public ClassLoader getClassLoader() { try { return getSystemLoader(); } catch (Exception e) { throw new RuntimeException(e); } }
@Override public ClassLoader getClassLoader() { try { return getSystemLoader(); } catch (final Exception e) { throw new LoaderRuntimeException(e); } }
@Override public void addJarsToPath(final File dir) throws Exception { this.addJarsToPath(dir, getSystemLoader()); if (getSystemLoader() == ClassLoader.getSystemClassLoader()) { this.rebuildJavaClassPathVariable(); } }
@Override public void addJarToPath(final URL jar) throws Exception { this.addJarToPath(jar, getSystemLoader()); if (getSystemLoader() == ClassLoader.getSystemClassLoader()) { this.rebuildJavaClassPathVariable(); } }
@Override public ClassLoader getClassLoader() { try { return getSystemLoader(); } catch (final Exception e) { throw new LoaderRuntimeException(e); } }
private void rebuildJavaClassPathVariable() throws Exception { sun.misc.URLClassPath cp = getURLClassPath(getSystemLoader()); URL[] urls = cp.getURLs(); if (urls.length < 1) return; StringBuffer path = new StringBuffer(urls.length * 32); File s = new File(URLDecoder.decode(urls[0].getFile())); path.append(s.getPath()); for (int i = 1; i < urls.length; i++) { path.append(File.pathSeparator); s = new File(URLDecoder.decode(urls[i].getFile())); path.append(s.getPath()); } try { System.setProperty("java.class.path", path.toString()); } catch (Exception e) { } } }
private void rebuildJavaClassPathVariable() throws Exception { final URLClassLoader loader = getSystemLoader(); final Object cp = getURLClassPath(loader); final Method getURLsMethod = getGetURLsMethod(); final URL[] urls = (URL[]) getURLsMethod.invoke(cp); if (urls.length < 1) { return; } final StringBuilder path = new StringBuilder(urls.length * 32); File s = new File(URLDecoder.decode(urls[0].getFile(), "UTF-8")); path.append(s.getPath()); for (int i = 1; i < urls.length; i++) { path.append(File.pathSeparator); s = new File(URLDecoder.decode(urls[i].getFile(), "UTF-8")); path.append(s.getPath()); } try { System.setProperty("java.class.path", path.toString()); } catch (final Exception e) { // no-op } }
private void rebuildJavaClassPathVariable() throws Exception { final URLClassLoader loader = getSystemLoader(); final Object cp = getURLClassPath(loader); final Method getURLsMethod = getGetURLsMethod(); final URL[] urls = (URL[]) getURLsMethod.invoke(cp); if (urls.length < 1) { return; } final StringBuilder path = new StringBuilder(urls.length * 32); File s = new File(URLDecoder.decode(urls[0].getFile(), "UTF-8")); path.append(s.getPath()); for (int i = 1; i < urls.length; i++) { path.append(File.pathSeparator); s = new File(URLDecoder.decode(urls[i].getFile(), "UTF-8")); path.append(s.getPath()); } try { System.setProperty("java.class.path", path.toString()); } catch (final Exception e) { // no-op } }
@Override public void addJarsToPath(final File dir) throws Exception { this.addJarsToPath(dir, getSystemLoader()); this.rebuildJavaClassPathVariable(); }
@Override public void addJarToPath(final URL jar) throws Exception { this.addJarToPath(jar, getSystemLoader()); this.rebuildJavaClassPathVariable(); }
public void addJarsToPath(File dir) throws Exception { this.addJarsToPath(dir, getSystemLoader()); this.rebuildJavaClassPathVariable(); }
public void addJarToPath(URL jar) throws Exception { this.addJarToPath(jar, getSystemLoader()); this.rebuildJavaClassPathVariable(); }