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