We have a class in java 7 and need to load it from a native code. The system already load some classes in java 6 with JNI, needing an upgrade. I install the new JDK, change include directories and link references in my VC project. All was well, until need to start the jre7 from jni... When call method JNI_CreateJavaVM, we pass the jni version in vm_args.version parameter, but don't have a definition for newer version than 1.6.
int ret = JNI_CreateJavaVM(&jvm, (void**)&env, &vm_args);
Running the program, when calls JNI method "FindClass" for a jre7 class, the jvm throws an UnsupportedClassVersionError exception. The exception is clear, I'm running a class that the jvm doesn't support, to be a newer version than it.
The problem: How do I to start, from JNI, a JVM that supports the jre7 classes? I tryed to search, but don't found any reference for this. That's possible? The JNI library supports jre7?
Yes, is the problem, now solved.
The cause was in the User Environment Variables, that sets the path to the jre6, preceding my settings when runs the application. I had checked the System environment, but had forgotten the User environment.