Call Java Method from API in .NET

老子叫甜甜 提交于 2021-02-04 15:09:18

问题


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?


回答1:


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)




回答2:


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




回答3:


You can use CORBA to "call" java methods from .NET.

For .NET here you can find some CORBA libraries.

Java SDK includes CORBA capabilities so you don't have to download 3rd party libraries.



来源:https://stackoverflow.com/questions/5928200/call-java-method-from-api-in-net

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!