When I create a Java 8 JVM in C++ I usually use something like the following code to tell JVM the class path:
JavaVMOption* options = new JavaVMOption[1]; // JVM invocation options
options[0].optionString = (char *)"-Djava.class.path=.;./lib2"; // where to find java .class
vm_args.version = JNI_VERSION_1.8; // minimum Java version
vm_args.nOptions = 1; // number of options
vm_args.options = options;
vm_args.ignoreUnrecognized = false;
But how to tell the Java 9 JVM about the module path? There is no java.module.path system property. The best I can find is something like:
JavaVMOption* options = new JavaVMOption[2]; // JVM invocation options
options[0].optionString = (char *)"-Djdk.module.path=.;./lib2"; // where to find java .class
options[1].optionString = (char *)"-Djdk.module.main=RemkaAgentService"; // where to find java .class
vm_args.version = JNI_VERSION_9; // minimum Java version
vm_args.nOptions = 2; // number of options
vm_args.options = options;
vm_args.ignoreUnrecognized = false;
But this code does not work, it fails when I try to create JVM. I suppose it is because it does not support the options I try.