Skip to main content

Call .NET method from Java

Please note these java.net forums are being decommissioned and use the new and improved forums at https://community.oracle.com/community/java.
2 replies [Last post]
kishorkna
Offline
Joined: 2011-10-13

I need to call a .net method residing inside a .dll file from my java program. I mean interoperability. anybody pls help me on this. I have tried some codes but have lots of issues.

Sample using loadLibrary( ) to call Native methods in Java

I tried this one.. But which tool I have to use for compiling the managed C++. If I use java some libraries wont support and if I use visual studio again some libraries are not supported that residing in java.

pls help me on this.

advance thanks..

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
javonet
Offline
Joined: 2013-04-02

Hi,

All the hard work can be left over to java to .net bridge like javonet.

Please check our project on Java.net:
https://java.net/projects/javonet

Javonet is one "jar" that you add to your JAVA project and with our API you can call and load any .NET library from your project directory or GAC. You can create .NET objects, invoke methods, set/get fields and use them like they were native JAVA classes.

Hope it will solve your and other similar users issues with java and .net interoperability.

More details in our quick start guide on official project website:
http://www.javonet.com/quick-start-guide/

Regards,
Przemek

amitsoni1234
Offline
Joined: 2011-10-07

Hi,

You can use Java API JNI (Java Native Interface) which is used to call the methods of another language like C/C++.

Try with JNI API.

Amit