Our Java-based application has a tiny "bootloader.jar" and the core application jars. The core application jars might be loaded either from the default (file system) location or from another where a previous application run might have downloaded updated jars. The bootloader runs following code:
final List<File> jars = getJarsToAddToClasspath();
final String mainClassName = getMainClassName();
final URLClassLoader urlClassLoader = new URLClassLoader(urls.toArray(new URL[urls.size()]), ClassLoader.getSystemClassLoader());
final Class<?> mainClass = urlClassLoader.loadClass(mainClassName);
final Method mainMethod = mainClass.getDeclaredMethod("main", String[].class);
mainMethod.invoke(null, new Object[] {args});
According to http://www.oracle.com/technetwork/java/javase/9-relnote-issues-3704069.html it looks like this won't work any more with Java 9:
Note that Java SE and the JDK do not provide an API for applications or libraries to dynamically augment the class path at run-time.
Could someone confirm this?