D
Dr. Dave Landis
Greetings:
I have a group of Java classes that I need to invoke from a Win32 DLL. The
following code, when executed from a stand-alone EXE works just fine. When
I insert it into my DLL, the JNI_CreateJavaVM function hangs. I'm not even
getting around to calling my classes, just trying to start the VM. The
jvm.dll is in my path. I've tried linking various MS runtimes, all to the
same effect -- the call to JNI_CreateJavaVM hangs permanently ( as a side
note, when this function is called, hpi.sll, verify.dll, java.dll and
zip.dll all get loaded, then the hang occurs). Please help. I'm in a
desparate time crunch.
Dave
<< code >>
BOOL InitJavaDriver(char* classname)
{
JNIEnv* env;
JavaVM* jvm;
jint retval;
char opt0[400];
char opt1[400];
int i;
JavaVMInitArgs vm_args;
JavaVMOption options[2];
memset(options,0,2*sizeof(JavaVMOption));
sprintf(opt0,"-Djava.class.path=%s\\OOIDrvJ.jar",BasePath);
sprintf(opt1,"-Djava.library.path=%s",BasePath);
options[0].optionString=opt0;
options[1].optionString=opt1;
vm_args.version=JNI_VERSION_1_2;
vm_args.options=options;
vm_args.nOptions=2;
vm_args.ignoreUnrecognized=JNI_TRUE;
retval=JNI_CreateJavaVM(&jvm,(void**)&env,&vm_args); ////// this is the
line that kills it
return TRUE;
}
<< debug output >>
Loaded 'ntdll.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\kernel32.dll', no matching symbolic information
found.
Loaded symbols for 'D:\OOIProg\Working\OOIDrv\OOIDrv32.dll' <<<<<<< my dll
Loaded symbols for 'C:\WINDOWS\system32\MSVCRTD.DLL'
Loaded 'C:\WINDOWS\system32\winmm.dll', no matching symbolic information
found.
Loaded 'C:\WINDOWS\system32\user32.dll', no matching symbolic information
found.
Loaded 'C:\WINDOWS\system32\gdi32.dll', no matching symbolic information
found.
Loaded 'C:\WINDOWS\system32\advapi32.dll', no matching symbolic information
found.
Loaded 'C:\WINDOWS\system32\rpcrt4.dll', no matching symbolic information
found.
Loaded 'C:\WINDOWS\system32\version.dll', no matching symbolic information
found.
Loaded 'C:\Program Files\Java\j2re1.4.1_03\bin\client\jvm.dll', no matching
symbolic information found.
Loaded 'C:\WINDOWS\system32\msvcrt.dll', no matching symbolic information
found.
Loaded 'C:\WINDOWS\system32\imm32.dll', no matching symbolic information
found.
<<<<< this starts my dll, the stuff below is loaded when i try to create the
VM
Loaded 'C:\Program Files\Java\j2re1.4.1_03\bin\hpi.dll', no matching
symbolic information found.
Loaded 'C:\Program Files\Java\j2re1.4.1_03\bin\verify.dll', no matching
symbolic information found.
Loaded 'C:\Program Files\Java\j2re1.4.1_03\bin\java.dll', no matching
symbolic information found.
Loaded 'C:\Program Files\Java\j2re1.4.1_03\bin\zip.dll', no matching
symbolic information found.
I have a group of Java classes that I need to invoke from a Win32 DLL. The
following code, when executed from a stand-alone EXE works just fine. When
I insert it into my DLL, the JNI_CreateJavaVM function hangs. I'm not even
getting around to calling my classes, just trying to start the VM. The
jvm.dll is in my path. I've tried linking various MS runtimes, all to the
same effect -- the call to JNI_CreateJavaVM hangs permanently ( as a side
note, when this function is called, hpi.sll, verify.dll, java.dll and
zip.dll all get loaded, then the hang occurs). Please help. I'm in a
desparate time crunch.
Dave
<< code >>
BOOL InitJavaDriver(char* classname)
{
JNIEnv* env;
JavaVM* jvm;
jint retval;
char opt0[400];
char opt1[400];
int i;
JavaVMInitArgs vm_args;
JavaVMOption options[2];
memset(options,0,2*sizeof(JavaVMOption));
sprintf(opt0,"-Djava.class.path=%s\\OOIDrvJ.jar",BasePath);
sprintf(opt1,"-Djava.library.path=%s",BasePath);
options[0].optionString=opt0;
options[1].optionString=opt1;
vm_args.version=JNI_VERSION_1_2;
vm_args.options=options;
vm_args.nOptions=2;
vm_args.ignoreUnrecognized=JNI_TRUE;
retval=JNI_CreateJavaVM(&jvm,(void**)&env,&vm_args); ////// this is the
line that kills it
return TRUE;
}
<< debug output >>
Loaded 'ntdll.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\kernel32.dll', no matching symbolic information
found.
Loaded symbols for 'D:\OOIProg\Working\OOIDrv\OOIDrv32.dll' <<<<<<< my dll
Loaded symbols for 'C:\WINDOWS\system32\MSVCRTD.DLL'
Loaded 'C:\WINDOWS\system32\winmm.dll', no matching symbolic information
found.
Loaded 'C:\WINDOWS\system32\user32.dll', no matching symbolic information
found.
Loaded 'C:\WINDOWS\system32\gdi32.dll', no matching symbolic information
found.
Loaded 'C:\WINDOWS\system32\advapi32.dll', no matching symbolic information
found.
Loaded 'C:\WINDOWS\system32\rpcrt4.dll', no matching symbolic information
found.
Loaded 'C:\WINDOWS\system32\version.dll', no matching symbolic information
found.
Loaded 'C:\Program Files\Java\j2re1.4.1_03\bin\client\jvm.dll', no matching
symbolic information found.
Loaded 'C:\WINDOWS\system32\msvcrt.dll', no matching symbolic information
found.
Loaded 'C:\WINDOWS\system32\imm32.dll', no matching symbolic information
found.
<<<<< this starts my dll, the stuff below is loaded when i try to create the
VM
Loaded 'C:\Program Files\Java\j2re1.4.1_03\bin\hpi.dll', no matching
symbolic information found.
Loaded 'C:\Program Files\Java\j2re1.4.1_03\bin\verify.dll', no matching
symbolic information found.
Loaded 'C:\Program Files\Java\j2re1.4.1_03\bin\java.dll', no matching
symbolic information found.
Loaded 'C:\Program Files\Java\j2re1.4.1_03\bin\zip.dll', no matching
symbolic information found.