Guy
Guy

Reputation: 945

Call any Java method from C#

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).

Upvotes: 7

Views: 6336

Answers (2)

user253984
user253984

Reputation:

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#.

Upvotes: 3

Marcelo Cantos
Marcelo Cantos

Reputation: 185852

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

Upvotes: 4

Related Questions