473,406 Members | 2,208 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Problems with JNI Invocation Interface

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.
Jul 17 '05 #1
1 6282
Nevermind. It turns out that you can call JNI_CreateJavaVM from the DllMain
of a DLL. No clue why, but if I move the call out of DllMain, it all works.

"Dr. Dave Landis" <dl*****@gte.net> wrote in message
news:8O****************@nwrddc03.gnilink.net...
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.

Jul 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: SpaceCowboy | last post by:
I recently got into a discussion with a co-worker about using enums across a dll interface. He wanted to use chars instead, argueing that depending on compiler settings the size of an enum could...
6
by: clintonG | last post by:
After the last six days trying to download VS2005 Professional it seems there may be a problem with my instance of the File Transfer Manager (FTM) or somewhere in the network in between. I can't...
6
by: Sharon | last post by:
How to catch an asynchronous delegate invocation exception? The code: --------------------------------------- String message = “my message”; foreach( MyDelegate handler in...
0
by: Shaul Dar | last post by:
Hi everyone, We have run into above problem recently. All I found so far are other people complaining that 1st invocation of a Web Service can be very slow, the problem size (delay) seems to...
0
by: Rafael Amorim | last post by:
Hello Guys, I have an application that is installed on three different data centers across the world (exactly the same environment and installed files for each one). I got some errors from...
3
by: Joshua Stewart | last post by:
Hi, I am trying to characterise a problem I am seeing on our C#/C++ xml driven application. We have recently added some basic Spanish language support to our application, but it seems that there...
6
by: Eric_Dexter | last post by:
I am writing out zero byte files with this (using python 2.5). I have no idea why I am having that problem, I am also looking for an example of readlines where I can choose a number of lines say...
3
by: Giulio Petrucci | last post by:
Hi there, I'm quite a newbie in Web Service programming/using and I'm sorry if my question could sound quite "stupid". ;-) I'm working on an application which should request a service to a...
0
by: Ilan | last post by:
Is there any python CORBA ORB that support Dynamic Invocation Interface? Thanks
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.