Solved

.Net dll from Java

Posted on 2010-09-23
7
951 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
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 
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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Should localization be done inside spring controller 5 27
Java exception bubble up 2 18
CSV file parsing thru Java 13 31
Problem to Alipay 10 24
For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.

831 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