I could not find a way how to set the module path using JNI_CreateJavaVM in Java 9 (9.0.4). I was expecting something like -Djava.class.path which is used to set the class path.
The jdk.internal.module,ModuleBootstrap class uses the system property "jdk.module.path".
// --module-path option specified to the launcher
ModuleFinder appModulePath = createModulePathFinder("jdk.module.path");
private static ModuleFinder createModulePathFinder(String prop) {
String s = System.getProperty(prop);
if (s == null) {
return null;
} else {
String[] dirs = s.split(File.pathSeparator);
Path[] paths = new Path[dirs.length];
int i = 0;
for (String dir: dirs) {
paths[i++] = Paths.get(dir);
}
return ModulePath.of(patcher, paths);
}
}
However using -Djdk.module.path as JNI_CreateJavaVM argument is ignored with the following warning:
Java HotSpot(TM) 64-Bit Server VM warning: Ignoring system property options whose names match the '-Djdk.module.*'. names that are reserved for internal use.
Does anybody has an idea how to pass the module-path using JNI_CreateJavaVM. Or is there an alternative to create a jvm in Java9 which I have missed?