Attempts to add the given file/URL to the class loader @param url Full path to the file to add @throws SecurityException if there is a security manager present and the operation is denied @throws IllegalArgumentException if the path was not a directory @throws NoSuchMethodException if there is an er
(final URL url)
| 273 | * @throws InvocationTargetException if there is an issue loading the jar |
| 274 | */ |
| 275 | private static void addURL(final URL url) throws SecurityException, |
| 276 | NoSuchMethodException, IllegalArgumentException, IllegalAccessException, |
| 277 | InvocationTargetException { |
| 278 | URLClassLoader sysloader = (URLClassLoader)ClassLoader.getSystemClassLoader(); |
| 279 | Class<?> sysclass = URLClassLoader.class; |
| 280 | |
| 281 | Method method = sysclass.getDeclaredMethod("addURL", PARAMETER_TYPES); |
| 282 | method.setAccessible(true); |
| 283 | method.invoke(sysloader, new Object[]{ url }); |
| 284 | LOG.debug("Successfully added JAR to class loader: " + url.getFile()); |
| 285 | } |
| 286 | } |