See the javadoc for java.lang.reflect.Layer http://download.java.net/java/jdk9/docs/api/java/lang/reflect/Layer.html
There is a simple example of something similar there. /Michael On Jan 11, 2017 6:04 PM, "Piotr Chmielewski" <piotr.ch....@gmail.com> wrote: > For one of my projects, I decided to create "plugin" system to load class > at runtime from JAR files. Currently, I load each plugin using > URLClassLoader. > > With arrival of JDK9, is there any plans for loading modules at runtime > (or is available already for testing in build snapshots)? For example > instead of: > > String pluginPath = "CPU_Monitor.jar"; > > URL pluginUrl = new URL(pluginPath); > > URL[] urls = {pluginUrl}; > > URLClassLoader urlClassLoader = new URLClassLoader(urls); > > Class<?> pluginClass = urlClassLoader.findClass("com. > example.cpu.monitoring.Monitor"); > > > Would be possible to use something like this: > > Module pluginModule = ModuleManager.getModule("com.e > xample.cpu.Monitoring"); > > Class<?> pluginClass = pluginModule.getClass("com.exa > mple.cpu.monitoring.Monitor"); > > > I guess that something like this could be implemented as library outside > JDK, but such API could be great addition to Jigsaw. > >