Calling Java from C#
-
Anyone have some good example code for calling Java routines from C#? - Bruce :confused: BRCKCC
Unless you're able to convert the Java .class file to a .NET assembly, I believe this will require either a COM bridge or Mono's IKVM Java runtime. Mono lead dev Miguel de Icaza wrote a Java app on top of Mono that might get you pointed in the right direction: clickity[^]. Additionally, if you have the Java source code, you could try recompiling as J# code which gets compiled as a .NET assembly. #include "witty_sig.h"
-
Anyone have some good example code for calling Java routines from C#? - Bruce :confused: BRCKCC
I've got an article on that at http://www.devx.com/interop/Article/19845[^]. It's a new edition of an article[^] I wrote for CodeProject alost two years ago, which was a rewrite of an article I wrote about a year before that. Sure, there are already bridge products that have been out for a couple years, but these articles will tell you how it's done (using JNI and, optionally, COM - though not required if you P/Invoke native functions from the JNI library you'd have to write). The DevX article I linked first goes into greater depth about calling Java methods from the JNI DLL.
Microsoft MVP, Visual C# My Articles