调用从C#的Java方法
问题描述:
有没有使用JNI和C#代码来创建调用任何给定的Java方法的程序的方式吗?
假设我有一个包含一个罐子的类层次结构,我负责加载JVM和这些类,我可以写接收动态Java方法签名+参数值的C#程序并调用java代码?
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?
请尽量限制您解答免费技术(JNI解决方案者优先)。
Please try to restrict your answers to free technologies (JNI solutions prefered).
答
IKVM 是一个选项。它在.net实现了JVM并提供互操作的工具。
IKVM is one option. It implements a JVM in .Net and provides interop tools.