JNI interoperating with .net DLL?

N

ntusbalumni

Hi,

How does one get a Java application (JNI) to call functions in
this .NET DLL?
Essential I can't get the JNI DLL to call the .NET DLL (CLI managed
code).
Is this a dead end or is there any other way?

I hope we don't need to use web services ...
It's just Java trying to talk to .NET DLL on a local machine.


Thanks

Regards,
Choong Leong
 
V

Vitaly

See
http://www.sharewareplaza.com/OOJNI-for-NET2-0-low-level-download_49440.html
http://www.sharewareplaza.com/Object-Oriented-JNI-for-NET-low-level-download_40782.html
http://www.sharewareplaza.com/OOJNI-Add-in-NET-for-VS7-1-download_43587.html

Vitaly

ntusbalumni said:
Hi,

How does one get a Java application (JNI) to call functions in
this .NET DLL?
Essential I can't get the JNI DLL to call the .NET DLL (CLI managed
code).
Is this a dead end or is there any other way?

I hope we don't need to use web services ...
It's just Java trying to talk to .NET DLL on a local machine.


Thanks

Regards,
Choong Leong



I'm protected by SpamBrave
http://www.spambrave.com/
 
T

Twisted

Hi,

How does one get a Java application (JNI) to call functions in
this .NET DLL?

Looking up appropriate reference ...
Lookup complete.

DEMONIC INVOCATION FOR BEGINNERS

To begin, obtain a pint of fresh goat's blood. Using this,
inscribe an inverted pentagram on the side of the hardware,
with the word "tfosorciM" in each of the five outer sections.
Then, using JNI, load the DLL and execute a jump to 0x00000666.

For further information, see Demonic Invocation for Necromancers
and Satanists of Intermediate Skill.
 
L

Lew

Twisted said:
Looking up appropriate reference ...
Lookup complete.

DEMONIC INVOCATION FOR BEGINNERS

To begin, obtain a pint of fresh goat's blood. Using this,
inscribe an inverted pentagram on the side of the hardware,
with the word "tfosorciM" in each of the five outer sections.
Then, using JNI, load the DLL and execute a jump to 0x00000666.

For further information, see Demonic Invocation for Necromancers
and Satanists of Intermediate Skill.

There is no such thing as Satan.
 
T

Twisted

There is no such thing as Satan.

I used to believe that. Then I saw some VB .NET code. And Vista's
EULA. And some of Microsoft's scarier "software as a service" and
"trusted computing" proposals.
 
B

Brandon McCombs

Lew said:
There is no such thing as Satan.

I guess that means we are free to kill, rape, and pillage anything we
want without fear of being punished for eternity. Everyone goes to
heaven no matter what. Time to go out and have some fun!
 
L

Lew

Twisted said:
I used to believe that. Then I saw some VB .NET code. And Vista's
EULA. And some of Microsoft's scarier "software as a service" and
"trusted computing" proposals.

Oh, there's evil, just no Satan. Still, you make a good case.
 
L

Lew

Brandon said:
I guess that means we are free to kill, rape, and pillage anything we
want without fear of being punished for eternity. Everyone goes to
heaven no matter what. Time to go out and have some fun!

That does not follow.
 
T

Twisted

That does not follow.

Mr. McCombs should surely have seen at least one process go into an
infinite loop eating CPU if he routinely engineers software; and if he
doesn't, what is he doing here? Yet if he has, why has he no concept
of limbo? :)
 
?

=?ISO-8859-1?Q?Arne_Vajh=F8j?=

ntusbalumni said:
How does one get a Java application (JNI) to call functions in
this .NET DLL?
Essential I can't get the JNI DLL to call the .NET DLL (CLI managed
code).
Is this a dead end or is there any other way?

I hope we don't need to use web services ...
It's just Java trying to talk to .NET DLL on a local machine.

It is not simple.

Java--(JNI)--C++ Win32 DLL--(COM)--COM wrapper .NET DLL--.NET DLL

should work.

(the C++ Win32 DLL does not need to be written by you - you can
find various COM for Java bridges).

Java--(socket)--wrapper .NET EXE--.NET DLL

is a bit primitive but probably the easiest to implement.

Arne
 
Joined
May 30, 2007
Messages
2
Reaction score
0
if you dont have a jni dll then u can use COM2JAVA tool to generate java classes from the dll and then use j-integra to integrate with the java application. use www.j-integra.com it has great functionality for accessing COM object or even DCOM objects

Mohammed
 
T

Tan Choong Leong

Hi Arne,

Thanks! My solution which is similar to yours works!

My solution is:

1. java (JNI) C++ Win32 DLL using LoadLibrary(), GetProcAddress() to call 2.
2. CLR DLL which export extern "C" function API to call 3.
3. Actual .Net DLL in question.

It works by calling as a standalone java class.

Next, what I need is to call functions in this class from a TOMCAT
environment. This fails with unknown reason.

I realised that if I remov the "Actual .NET" function call in the CLR
DLL in step 2. with some dummy data, there is no problem in the Tomcat
environment.

It just beats me that why as a standalone Java class it works but not in
a Tomcat environment.

1. Could it be some security issue?
2. or path problem?

All Dlls are in C:/windows/system32

An excerpt from the error logs:
#
# An unexpected error has been detected by Java Runtime Environment:
#
# Internal Error (0xe0434f4d), pid=508, tid=3964
#
# Java VM: Java HotSpot(TM) Client VM (1.6.0_01-b06 mixed mode, sharing)
# Problematic frame:
# C [kernel32.dll+0x12a5b]
#
# If you would like to submit a bug report, please visit:
# http://java.sun.com/webapps/bugreport/crash.jsp
#

--------------- T H R E A D ---------------

Current thread (0x03704c00): JavaThread "http-8081-1" daemon
[_thread_in_native, id=3964]

siginfo: ExceptionCode=0xe0434f4d, ExceptionInformation=0x80070002

Registers:
EAX=0x04e4eb3c, EBX=0x00083a60, ECX=0x00000000, EDX=0x00000025
ESP=0x04e4eb38, EBP=0x04e4eb8c, ESI=0x04e4ebc8, EDI=0xe0434f4d
EIP=0x7c812a5b, EFLAGS=0x00000202
Blah blah blah.....
 
?

=?ISO-8859-1?Q?Arne_Vajh=F8j?=

Tan said:
My solution is:

1. java (JNI) C++ Win32 DLL using LoadLibrary(), GetProcAddress() to
call 2.
2. CLR DLL which export extern "C" function API to call 3.
3. Actual .Net DLL in question.

It works by calling as a standalone java class.

Next, what I need is to call functions in this class from a TOMCAT
environment. This fails with unknown reason.

I realised that if I remov the "Actual .NET" function call in the CLR
DLL in step 2. with some dummy data, there is no problem in the Tomcat
environment.

What does the actual implementation do ?
It just beats me that why as a standalone Java class it works but not in
a Tomcat environment.

1. Could it be some security issue?
2. or path problem?

All Dlls are in C:/windows/system32

An excerpt from the error logs:
#
# An unexpected error has been detected by Java Runtime Environment:
#
# Internal Error (0xe0434f4d), pid=508, tid=3964
#
# Java VM: Java HotSpot(TM) Client VM (1.6.0_01-b06 mixed mode, sharing)
# Problematic frame:
# C [kernel32.dll+0x12a5b]
#
# If you would like to submit a bug report, please visit:
# http://java.sun.com/webapps/bugreport/crash.jsp
#

--------------- T H R E A D ---------------

Current thread (0x03704c00): JavaThread "http-8081-1" daemon
[_thread_in_native, id=3964]

siginfo: ExceptionCode=0xe0434f4d, ExceptionInformation=0x80070002

Registers:
EAX=0x04e4eb3c, EBX=0x00083a60, ECX=0x00000000, EDX=0x00000025
ESP=0x04e4eb38, EBP=0x04e4eb8c, ESI=0x04e4ebc8, EDI=0xe0434f4d
EIP=0x7c812a5b, EFLAGS=0x00000202
Blah blah blah.....

Arne
 
T

Tan Choong Leong

Hi Arne,

The actual .NET dll is actually a driver provided by a third party
vendor that can communicate with a device using socket (TCP/IP). I do
not have the source code of this driver or knows the protocol of this
device. I just have some function call definition (by looking at the dll
from the object browser) and some sample code.

Regards,

Choong Leong
Tan said:
My solution is:

1. java (JNI) C++ Win32 DLL using LoadLibrary(), GetProcAddress() to
call 2.
2. CLR DLL which export extern "C" function API to call 3.
3. Actual .Net DLL in question.

It works by calling as a standalone java class.

Next, what I need is to call functions in this class from a TOMCAT
environment. This fails with unknown reason.

I realised that if I remov the "Actual .NET" function call in the CLR
DLL in step 2. with some dummy data, there is no problem in the Tomcat
environment.

What does the actual implementation do ?
It just beats me that why as a standalone Java class it works but not
in a Tomcat environment.

1. Could it be some security issue?
2. or path problem?

All Dlls are in C:/windows/system32

An excerpt from the error logs:
#
# An unexpected error has been detected by Java Runtime Environment:
#
# Internal Error (0xe0434f4d), pid=508, tid=3964
#
# Java VM: Java HotSpot(TM) Client VM (1.6.0_01-b06 mixed mode, sharing)
# Problematic frame:
# C [kernel32.dll+0x12a5b]
#
# If you would like to submit a bug report, please visit:
# http://java.sun.com/webapps/bugreport/crash.jsp
#

--------------- T H R E A D ---------------

Current thread (0x03704c00): JavaThread "http-8081-1" daemon
[_thread_in_native, id=3964]

siginfo: ExceptionCode=0xe0434f4d, ExceptionInformation=0x80070002

Registers:
EAX=0x04e4eb3c, EBX=0x00083a60, ECX=0x00000000, EDX=0x00000025
ESP=0x04e4eb38, EBP=0x04e4eb8c, ESI=0x04e4ebc8, EDI=0xe0434f4d
EIP=0x7c812a5b, EFLAGS=0x00000202
Blah blah blah.....

Arne
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,772
Messages
2,569,593
Members
45,112
Latest member
BrentonMcc
Top