Code to make your toes curl.

So Joe and I have been looking into the VSTS client API, and are starting to get a handle on the objects and calls required to interact with the source code control system, however, we are now trying to work out the best way to call the .NET assemblies from within our Eclipse plug-in.

While googling for a solid solution to our problem, I came across IKVM.NET, and it’s kinda blown my mind. Now from what I can understand from the blog, it’s an implementation of the JVM spec for .NET (Jeroen correct me if I’m way off), so you can run Java applications using the .NET.

I’m downloading the code now, so I’ll post some more when I crack it open…WOW!

Comments (3)

  1. Yes, you’ve got it pretty much right, and it’s frikkin’ awesome.

    Not only can you run your Java code directly under .NET by using it as a drop-in JVM replacement, you can also compile your Java code to .NET assemblies and create, say, eclipse.exe which you can ship with a couple of DLLs and run on any machine with the framework installed. (Disclaimer: I haven’t tried this with eclipse specifically and I know that there’s some black magic involved in what eclipse does with classloading, so it may be tricky to produce eclipse.exe, but most Java programs work out of the box).

    I use this as part of my build process because I have a DAL written in Java being used, now, primarily for C# development. Everybody has the framework but most people don’t have the JDK. So I just used IKVM to compile my DAL tool into an exe so it runs with (effectively) no dependencies. I also have a DLL made from Microsoft’s SQL Server JDBC driver jars so my exe can talk to SQL Server.

  2. Zac says:

    Thanks for the plug on the IKVM. It grew up right in our very own Mono but now runs natively on MS .NET.

    IKVM has a Java byte code to CLI converter which is the greatest part. Also a stub generator for .NET assemblies so you can link and compile the .NET assemblies so when they run on .NET they call the native ones on the .NET side. We even made it capable of calling JNI via P/Invoke.

    Watch the licence though. The default version uses GNU Classpath under the hood which is GPL with a special linking exception (which is far less then even LGPL). I don’t think Microsoft would like it to much for the fact that you are using GNU classpath :-P.