Errors while trying to initialize vm_args

When I initialize JDK1_1InitArgswith JDK1_1InitArgs vm_args, the compiler gives me errors. I need this variable initialized to use the function JNI_CreateJavaVM.

            JavaVM *jvm;
            JNIEnv *env;
            jmethodID mid;
            JDK1_1InitArgs vm_args; // Line 47
            vm_args.version = 0x00010001; // Line 48
            JNI_GetDefaultJavaVMInitArgs(&vm_args);
            vm_args.classpath = "C:/Program Files/Java/jdk1.7.0/lib;.;";

            JNI_CreateJavaVM(&jvm, &env, &vm_args);
            env = (*jvm)->AttachCurrentThread(jvm,&env,NULL);
            jclass cls = (*env)->GetObjectClass(env,Obj);
            mid = (*env)->GetMethodID(env,cls,"callBack","(Ljava/lang/String;)V");
            (*env)->CallVoidMethodA(env,Obj,mid,(*env)->NewStringUTF(env,"1B"));

Link

Errors:

enter image description here

Why am I getting these errors? How can I get rid of them?

+5
source share
1 answer

JNI 1.1 is no longer supported. See Comment from HotSpot jvm.h, just before the definition struct JDK1_1InitArgs:

This structure is used by the launcher to get the default thread size of the stack from the virtual machine using JNI_GetDefaultJavaVMInitArgs () since version 1.1. Since it is not supported otherwise, it has been removed from jni.h

: http://hg.openjdk.java.net/jdk7/jdk7/hotspot/file/tip/src/share/vm/prims/jvm.h, 1673

, JVM 1.1 JDK 7, , , 1.2, JDK.

+1

All Articles