Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I call .NET code from Java?

Tags:

I'm not looking for the usual answer like Web-services. I'm looking for a light solution to be run in the same machine.

Edit: I'm looking for way in Java to call .NET methods

like image 608
Eduardo Santa Avatar asked Nov 12 '08 11:11

Eduardo Santa


People also ask

Can .NET use Java?

NET standard library are written in C#. The language is object-oriented and is designed to be similar enough to C to be easy for C, C++, Java, and JavaScript developers to quickly learn and use.

Can we use .NET DLL in Java?

All you need is call "AddReference(your. dll)" and next invoke any method using reflection-style API. You can invoke any methods, set/get fields and properties, get results, subscribe events or handle exceptions.

What is jni4net?

The framework is jni4net – a bridge between java and . NET on Microsoft Windows platforms. It's an open-source framework with an LGPL runtime license.


2 Answers

I am author of jni4net, open source interprocess bridge between JVM and CLR. It's build on top of JNI and PInvoke. No C/C++ code needed. I hope it will help you.

like image 145
Pavel Savara Avatar answered Nov 02 '22 05:11

Pavel Savara


I believe Java can talk to COM and .NET can expose COM interfaces. So that may be a very light weight solution that doesn't require any 3rd party. There is also the option of using sockets to communicate between the programs which wouldn't require a heavy instance of IIS to be installed on the machine.

like image 33
Nick Berardi Avatar answered Nov 02 '22 03:11

Nick Berardi