简体   繁体   English

从JAVA调用方法C#.NET

[英]Calling methods C#.NET from JAVA

I have a dll created out of a C#.NET project and I would like to call the methods from a java program. 我有一个C#.NET项目中创建的dll,我想从Java程序中调用方法。 I was wondering as to what sort of opportunities exist to accomplish this and then I came across JNA and JNI. 我想知道是否存在实现此目标的机会,然后遇到了JNA和JNI。 Which one should I use for my purpose? 我应该使用哪一个来达到目的? Any suggestions? 有什么建议么? All I need is to call the methods in a class written using C#.NET and process the results from my Java program. 我只需要在使用C#.NET编写的类中调用方法并处理Java程序的结果即可。

It would depend on your application, But you could place the C# DLL within a service eg WCF and expose the functionality to the Java code that way. 这将取决于您的应用程序,但是您可以将C#DLL放在服务(例如WCF)中,并以这种方式向Java代码公开功能。 Using wsimport to generate your client code within Java. 使用wsimport在Java中生成您的客户端代码。

It saves the need to use cross over tools like JNI... 它节省了使用交叉工具(如JNI)的需要。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM