从 .NET 中的 API 调用 Java 方法
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5928200/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Call Java Method from API in .NET
提问by aumanets
I have a Java API in jar file with some dependencies from other jar files.
我在 jar 文件中有一个 Java API,它有一些来自其他 jar 文件的依赖项。
Is there any way to call a specific method from this API, like using PInvoke from .NET?
有没有办法从这个 API 调用特定的方法,比如使用 .NET 中的 PInvoke?
Thank you.
谢谢你。
采纳答案by Lasse Espeholt
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)
(1) 如果您只想要一些 Java 库。
(2.1) 如果您有权访问代码。
(2.2) 不得已,将Java动态加载到.Net中(解释器)
回答by Enrique
回答by Miguel Angelo
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.
我认为 .net 和 java 互操作不是一件容易的事。也许您可以使用套接字,并使用它们将消息从一个环境发送到另一个环境。不过,这只是一个想法。
EDIT:
编辑:
I have found some libs that say they can do this:
我发现一些库说他们可以做到这一点: