K
kent
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
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