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 } }