I am using JNI to load class from a jar. If i add the required jar in VM Options then i am able to load any class from that jar.
JavaVMOption options[1];
options[0].optionString = "-Djava.library.path=xyz.jar";
Whereas if i include the jar path in system environment variable (CLASSPATH) then unable to load any class from that jar; even though its part of classpath.
When you create the JVM you’re responsible for setting up the class path – you need to read the environment variable and pass it to
JNI_CreateJavaVM.JNI_GetDefaultJavaVMInitArgsmay set this up for you, but you’ll need to call it and pass the init args toJNI_CreateJavaVM