Call any Java method from C#

ぐ巨炮叔叔 提交于 2019-12-12 10:53:58

问题


Is there a way using JNI and C# code to create a program that invoke any given Java method? Assume that I have a jar containing classes hierarchy and I'm responsible for loading the JVM and these classes, can I write a C# program that receives the java method signature + arguments values on the fly and call the java code?

Please try to restrict your answers to free technologies (JNI solutions prefered).


回答1:


IKVM is one option. It implements a JVM in .Net and provides interop tools.




回答2:


IMHO the best way would be to run the Java Program as a WebService (or create a Java based WebService Interface for it) and just call it from C#.



来源:https://stackoverflow.com/questions/2591935/call-any-java-method-from-c-sharp

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