When i initialize JDK1_1InitArgs
using JDK1_1InitArgs vm_args
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"));
Reference
Errors :
Why do i get these errors ? How can i get rid of them ?
JNI 1.1 is no longer supported. See a comment from HotSpot's jvm.h
, right before the definition of struct JDK1_1InitArgs
:
This structure is used by the launcher to get the default thread stack size from the VM using JNI_GetDefaultJavaVMInitArgs() with a version of 1.1. As it is not supported otherwise, it has been removed from jni.h
Source: http://hg.openjdk.java.net/jdk7/jdk7/hotspot/file/tip/src/share/vm/prims/jvm.h, line 1673
It appears to be impossible to create a JVM versioned 1.1 in JDK 7 -- which means that you might want to use a later version such as 1.2, or use an older JDK.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With