Solved

.Net dll from Java

Posted on 2010-09-23
7
952 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
Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Weekend adv creator 3 52
javap bin 2 41
iterator/ListIterator approach 17 39
junit as external jar or library 7 23
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Update (December 2011): Since this article was published, the things have changed for good for Android native developers. The Sequoyah Project (http://www.eclipse.org/sequoyah/) automates most of the tasks discussed in this article. You can even fin…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
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.

860 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