This discussion is archived
2 Replies Latest reply: Sep 12, 2012 4:19 AM by 961427 RSS

Problem calling a jre7 class from jni

961427 Newbie
Currently Being Moderated
Hi,
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.

          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);

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?


Regards


ps. sorry for my "brazilian" english

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points