Have you ever found a neat-looking API that would save you tons of time and pain, only to have your hopes crushed when you discover that the API is written in Java? Well, fret no more, because there’s a nice, easy way to leverage tasty Java APIs from within .NET: just compile them to IL using IKVM.NET!
I’m currently using the excellent Weka machine learning library from .NET. Here’s the code:
To convert an existing Java .jar file into a .NET DLL, simple run “ikvmc.exe –target:library something.jar”. After a bit of chugging, you should get “something.dll”, ready for use in .NET. Be sure you add references to IKVM.OpenJDK.ClassLibrary.dll and IKVM.Runtime wherever you use your new DLL.