Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Call Java Method from API in .NET

Tags:

java

c#

pinvoke

I have a Java API in jar file with some dependencies from other jar files.

Is there any way to call a specific method from this API, like using PInvoke from .NET?

like image 238
aumanets Avatar asked May 08 '11 15:05

aumanets


2 Answers

Here you go :) I've used it myself and was very please with the implementation.

IKVM: Using Java API's in .NET Applications

  • (1) If you just want some libraries from Java.

  • (2.1) If you have access to the code.

  • (2.2) Last resort, dynamically load the Java into .Net (interpreter)

like image 64
Lasse Espeholt Avatar answered Oct 09 '22 02:10

Lasse Espeholt


I don't think it will be an easy task to interoperate .net and java. May be you could use sockets, and use them to send messages from one environment to another. It is just an idea, though.

EDIT:

I have found some libs that say they can do this:

http://www.jnbridge.com/

http://www.codeproject.com/KB/dotnet/Espresso.aspx

like image 1
Miguel Angelo Avatar answered Oct 09 '22 04:10

Miguel Angelo