Pages

July 29, 2008

Bringing Java to the .NET world

I was killing some time the other day when I stumbled across a pretty interesting open source project named ikvm. With ikvm, you can take Java byte code and convert it into the .NET CIL (.NET code all compiles down to CIL. Yes, Microsoft stole the idea from Java, haha). This means that all of the nice open source Java libraries we use can be converted by ikvm and used in .NET applications.

ikvm is fairly simple to use as well.

You want to convert an executable jar to a Windows application?
ikvmc -target:exe application.jar

Output: application.exe, a Windows console app
Note: GUI applications should use 'winexe' for the target.

You want to convert a library? Easy.
ikvmc -target:library awesomeLibrary.jar

Output: awesomeLibrary.dll


You can even use ikvm to run Java programs as it is basically a .NET implementation of the JVM.

I found all this pretty amazing since there are products on the market right now that charge in the thousands of dollars to do what this project does for free. I tell you, this new age of open source development is kicking ass!! This project brought us that much closer to having .NET and Java code coexisting and playing nice with each other.

4 comments:

  1. wow, that sounds nice, could you try it with some big java project? like hibernate or maybe eclipse? :P i know that not everything might work, but it could be fun.

    ReplyDelete
  2. ikvm is cool. I have more fun going the other way though. With mainsoft's product you can actually write c# (i.e. use the feature currently being debated for Java7 and 8) and run it on the JVM:

    http://dev.mainsoft.com/Default.aspx?tabid=267

    ReplyDelete
  3. This is a great approach, if what you want is byte code. In terms of reusability, sometimes you want to leverage your old code as source.

    I wrote a VB.Net to Java converter that lets you do that. It resolves all unknowns, and provides an open source platform for implementing .Net services on top of Java. If you download the free trial, you get the 2.j0 .Net XML API built on top of Java 6.0, as open source Java. Check it out!
    http://www.beelucid.com

    ReplyDelete
  4. I never thought that people will work to bring together such a highly used languages i.e. Java and .NET is ikvm really successful to do so.I think this is not much popular but it will be sooner

    ReplyDelete