C
Chao Dong
I am trying to create a JVM from a DLL, however, when including the
call to JNI_CreateJavaVM(), the DLL will fail to get loaded (with
error code of 126 which means failed to locate the module). If comment
this function call out, then the DLL load was fine.
I've got this problem once but left it behind until it mysteriously
disappeared after I have fixed some irrelevant bugs and come back to
the problem. Now it happens again when I try to run this DLL on a
laptop. My Pc is running Windows 2000 5.00.2195 Service Pack 2 with
JRE 1.4.1_01, while the laptop is running Windows 2000 5.00.2195
Service Pack 3 with JRE 1.4.1_02. VC6 is used to compile and link the
DLL.
Any comments will be highly appreciated.
The following is the standard code to create JVM:
JavaVMInitArgs vm_args;
jint retValue=1;
vm_args.version = JNI_VERSION_1_2;
vm_args.ignoreUnrecognized = JNI_TRUE;
vm_args.nOptions = 1;
JavaVMOption options[1];
char classPath[256];
strcpy(classPath, "-Djava.class.path=.\");
options[0].optionString = classPath;
options[0].extraInfo = NULL;
vm_args.options = options;
//The inclusion of the following call will fail the load of this DLL
//while it's fine if comment it out (jvm and env are declared
somewhere else)
retValue = JNI_CreateJavaVM(&jvm, (void **) &env, &vm_args);
Regards
Chao
call to JNI_CreateJavaVM(), the DLL will fail to get loaded (with
error code of 126 which means failed to locate the module). If comment
this function call out, then the DLL load was fine.
I've got this problem once but left it behind until it mysteriously
disappeared after I have fixed some irrelevant bugs and come back to
the problem. Now it happens again when I try to run this DLL on a
laptop. My Pc is running Windows 2000 5.00.2195 Service Pack 2 with
JRE 1.4.1_01, while the laptop is running Windows 2000 5.00.2195
Service Pack 3 with JRE 1.4.1_02. VC6 is used to compile and link the
DLL.
Any comments will be highly appreciated.
The following is the standard code to create JVM:
JavaVMInitArgs vm_args;
jint retValue=1;
vm_args.version = JNI_VERSION_1_2;
vm_args.ignoreUnrecognized = JNI_TRUE;
vm_args.nOptions = 1;
JavaVMOption options[1];
char classPath[256];
strcpy(classPath, "-Djava.class.path=.\");
options[0].optionString = classPath;
options[0].extraInfo = NULL;
vm_args.options = options;
//The inclusion of the following call will fail the load of this DLL
//while it's fine if comment it out (jvm and env are declared
somewhere else)
retValue = JNI_CreateJavaVM(&jvm, (void **) &env, &vm_args);
Regards
Chao