Link to home
Start Free TrialLog in
Avatar of Amitava_Mukherjee
Amitava_MukherjeeFlag for India

asked on

.Net dll from Java

Hi,

I found numerous links about how C++ / Win32 dll s can be called from Java. Some useful links are given below.

http://sourceforge.net/projects/jawinproject/
https://www.experts-exchange.com/questions/23025774/Java-and-DLLs.html?sfQueryTermInfo=1+10+30+dll+java

etc. etc.

Now my question is can I use .Net dlls from java?  If it is possible then how it is possible? I repeat, I am not asking about COM dll, but asking about .Net dlls. Which may be heavily dependent on Framework.

Is it possible? I have not any fair idea about CORBA / JNI. Is this possible in those?
Avatar of ksivananth
ksivananth
Flag of United States of America image

ASKER CERTIFIED SOLUTION
Avatar of ksivananth
ksivananth
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Amitava_Mukherjee

ASKER

Yes, those r nice links which is telling that .Net dlls can be used from Java by JNI. Thanx for that. I really appreciate for those links.

But is there any sample code which demonstrates how to use C# 2008 dll from Java? I am not finding any links, all those are available which are demonstration of how to call C/C++ dlls from java. Please help
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
is it? there is no diffrence between C/C++ dll and those dlls generated in C# by "Class Library" type project selection? If I add following two lines in that C# dll

using system.windows.forms;

public void SayHello()
{
  MessageBox.Show("Hello", "Test", MessageBoxButton.OK, MessageBoxIcon.Information);
}

compile that in dll, and try to call it from Java, should it work?

Thanx
OK, searching in net I have found a usefull (for me atleast) link at the following:

http://www.codeproject.com/KB/java/DebugJavaJNIApplication.aspx

Now as I proceed believing C# dll will work with JNI same as the C++ do, I have stuck out in the following codes of the above link !

#include "NativeAdd.h"

jdouble JNICALL Java_nativegui_NativeAdd_add
  (JNIEnv *env, jclass cls, jdouble n1, jdouble n2)
{
    return n1 + n2;
}

No place to write those lines in C# !! Please help, how this can be done in C#?

Thanx
THanx