Creating a JVM java7 with JNI call API

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?

+5
source share
2 answers

, jre6 jre7. Visual ++ → Property Pages- > Debugging- > Environment, : = C:\Java\jre7\Bin; C:\Java\jre7\Bin\;% PATH%

: - > - > - >

+1

Mac :

Java 7 Java 6 OS X 10.8.2? https://superuser.com/questions/490425/how-do-i-switch-between-java-7-and-java-6-on-os-x-10-8-2

JNI, Java. , "java_home" :

/usr/libexec/java_home -v 1.6.0_45 --exec javac Sample.java

+1

All Articles