如何从 C# 调用 Java 代码?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/129989/
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
How to call Java code from C#?
提问by
We've developed a Java application and would like to use this application from a C# client. The application has dependencies on Spring, Log4j, ...
我们开发了一个 Java 应用程序,并希望从 C# 客户端使用该应用程序。该应用程序依赖于 Spring、Log4j、...
What would be the most efficient mechanism - make DLL(s) from Java code, ... - to achieve this ?
什么是最有效的机制 - 从 Java 代码制作 DLL,... - 实现这一目标?
回答by MagicKat
回答by Omar Kooheji
alternatively you could write a webservice/xmlrpc layer between the two.
或者,您可以在两者之间编写一个 webservice/xmlrpc 层。
I seem to remember that there is a tool calles grassshopper that will compile your .Net code into JVM bytecode.
我似乎记得有一个工具叫做蚱蜢,可以将你的 .Net 代码编译成 JVM 字节码。
I've also heard good things about IKVM
我也听说过关于 IKVM 的好消息
回答by Pavel Savara
回答by Jaye
There are so many options,
有很多选择,
sockets
web services
Message bus
Use a/any database! (sorry if sound silly)
插座
网页服务
消息总线
使用一个/任何数据库!(对不起,如果听起来很傻)
Here's a discussion which may be handy: https://gridwizard.wordpress.com/2015/01/14/java-and-dotnet-interop
这是一个可能很方便的讨论:https: //gridwizard.wordpress.com/2015/01/14/java-and-dotnet-interop
Really depends on what you're building!
真的取决于你在建造什么!