We have a class in java 7 and we need to load it from our own code. I already used java 6 with JNI, but java 6 cannot load this class. So I installed the new JDK, changed the link directories and link links in my VC project, etc. Everything was fine until I wanted to run jre7 from JNI:
JNI_CreateJavaVM transfers the java version to the vm_args.version parameter , but there is no definition for a newer version than 1.6.
JavaVMInitArgs vm_args;
...
vm_args.version = JNI_VERSION_1_6;
vm_args.nOptions = 2;
vm_args.options = options;
vm_args.ignoreUnrecognized = 0;
int ret = JNI_CreateJavaVM(&jvm, (void**)&env, &vm_args);
The call FindClassto the java7 class obviously creates an UnsupportedClassVersionError.
Problem: How to create java7 JVM with JNI_CreateJavaVM?
source
share