Running Java on NET/Mono: Jeroens Frijters Discusses IKVM.NET
IKVM.NET (IKVM) is a JVM for the .NET and Mono platforms which allows users to execute Java applications directly. Microsoft's Erik Meijer recently sat down with IKVM creator Jeroen Frijters to discuss several different aspects of the project. The interview is wide-ranging, from discussing the internals of IKVM to the project's goals for the future. Here are some highlights:
Frijters has worked on the project as primary developer since its inception in 2002. The interview begins with Frijters discussing how IKVM is part of the Mono project, enabling a mutually beneficial relationship where the two projects can contribute patches to each other. Architecturally, IKVM has fully implemented the Java memory model on .NET. Frijters tries to avoid wrappers, which necessitates the need for some special case code to correctly handle Java's string interfaces.
.NET developers can use custom attributes in Java code if this code will be run on IKVM. Both platforms (Java and .NET) can use attributes both ways if the code is run on IKVM. So one can use .NET custom attributes in Java code and one can also use Java annotations on C# classes and members.
Under the hood, IKVM's runtime and compiler are written primarily in C#. Frijters is able to take the publicly available Java code (which at various points has been from GNU Classpath, OpenJDK, and others) and replaces the native C code therein with managed code. Unless a user utilizes native code in their application, a Java application paired with IKVM is fully portable as IKVM does not use any native code.
At this time IKVM has full support for Java 7, including support for the new instruction invoke dynamic. However, Frijters admits that there is still much to be done to increase the performance of newer instructions.
Kudos to Jeroen !
Re: great tool
Yes! IKVM is absolutely amazing. Its used in complex production tested libraries like Saxonica.Net that I've found to be excellent.
I've personally tested it on a large and very fiddly Swing + Java2D application I wrote for my phd, with a very complex computation layer. On the first pass it produced a workable version that ran on the CLR with a similar level of performance to the Java version. Had a few swing nigglies, but nothing serious. Absolutely amazing.
Anatole Tresch Mar 03, 2015