public static void addJarToClasspath ( ClassLoader loader , URL url ) throws IOException , IllegalAccessException , IllegalArgumentException , InvocationTargetException , NoSuchMethodException , SecurityException { URLClassLoader sysloader = ( URLClassLoader ) loader ; Class < ? > sysclass = URLClassLoader . class ; Method method = sysclass . getDeclaredMethod ( MyClasspathUtils . ADD_URL_METHOD , new Class [ ] { URL . class } ) ; method . setAccessible ( true ) ; method . invoke ( sysloader , new Object [ ] { url } ) ; }
Add an URL to the given classloader