Solved

.Net dll from Java

Posted on 2010-09-23
7
949 Views
Last Modified: 2013-12-14
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/
http://www.experts-exchange.com/Programming/Languages/Java/New_to_Java/Q_23025774.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?
0
Comment
Question by:Amitava_Mukherjee
  • 4
  • 2
7 Comments
 
LVL 26

Expert Comment

by:ksivananth
ID: 33751425
0
 
LVL 26

Accepted Solution

by:
ksivananth earned 250 total points
ID: 33751469
0
 

Author Comment

by:Amitava_Mukherjee
ID: 33752445
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
0
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 
LVL 10

Assisted Solution

by:gordon_vt02
gordon_vt02 earned 250 total points
ID: 33754489
The same principles should apply to the C# DLL as the C/C++ DLLs.  It is still a native interface.  As long as you are running on a Windows platform and have your java.library.path set correctly you should be ok.
0
 

Author Comment

by:Amitava_Mukherjee
ID: 33759098
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
0
 

Author Comment

by:Amitava_Mukherjee
ID: 33763015
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
0
 

Author Closing Comment

by:Amitava_Mukherjee
ID: 33767129
THanx
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
factorial example challenge 10 61
Updating Java 9 87
stringclean challenge 26 56
what is a "java.lang.System Property"   ? 20 35
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
This video teaches viewers about errors in exception handling.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now