Patch-module with dynamic layer creating.

Alex Sviridov ooo_saturn7 at mail.ru
Thu Oct 11 09:57:45 UTC 2018


Hi all,

I create ModuleLayer this way

ModuleFinder finder = ModuleFinder.of(dir1, dir2, dir3);
ModuleLayer parent = ModuleLayer.boot();
Configuration cf = parent.configuration().resolve(finder, ModuleFinder.of(), Set.of("myapp"));
ClassLoader scl = ClassLoader.getSystemClassLoader();
ModuleLayer layer = parent.defineModulesWithOneLoader(cf, scl);
Class<?> c = layer.findLoader("myapp").loadClass("app.Main");

And I need for newly created layer make the following:
-patch-module java.xml.ws.annotation=jsr305-3.0.2.jar

Could anyone say, how I can do it, taking into consideration that when I start JVM I don't
know what layers I will create and what patch module I will need to use, so
I can not use for it JVM parameters.

-- 
Best regards, Alex Sviridov


More information about the jigsaw-dev mailing list