Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Using Java from .Net (C#) with JNI

Reply
Thread Tools

Using Java from .Net (C#) with JNI

 
 
Sebastien Roeckel
Guest
Posts: n/a
 
      04-01-2004
Hello

I have a java class and I want to call it from a .Net project (in C#).

What I have done for now:
- I have written C++ code (by using Visual Studio 6.0) to call the java
class by using the JNI: this is working. This code has been included in a
dll.
- When I am calling the dll from a .Net project, the following exception is
raised "Object not set to an instance of an object"

When I call this DLL from an executable written in C++ (built with Visual
Studio 6): it is working.
When I call another DLL (which does not use JNI) from the .Net project it is
also working.

The problem comes from running the JNI in .Net.


I finally found that the JNI function JNI_CreateJavaVM (for initializing
the JVM and the environment) returns null objects (instead of initialized
pointers to the JVM and to the environment) when the DLL is called from a
..Net project.


Does anybody know why the JVM is not correctly initialized when the DLL is
called from .Net code ? What can I do to make it work ? (probably by
modifying the init arguments passed to the JNI_CreateJavaVM function ??)


Thank you for your help


Sebastien


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
JNI thread vs. native thread vs. JNI call bgabrhelik Java 0 09-29-2009 03:33 PM
Re: JNI: Error loading DLL from JNI DDL vasanth Java 0 01-25-2005 11:03 AM
Re: JNI: Error loading DLL from JNI DDL vasanth Java 0 01-25-2005 11:01 AM
Porting JNI Windows under JNI LINUX + Wine ? Pasturel Jean-Louis Java 5 03-03-2004 07:50 PM
IBM's JNI fails where Sun's JNI works Alex Hunsley Java 4 11-04-2003 10:34 AM



Advertisments