IKVM.NET
 
   

IKVM.NET User's Guide

Introduction

IKVM.NET is a Java Virtual Machine (JVM) for the .NET and Mono runtimes. At a time when most people in the computer industry consider Java and .NET as mutually exclusive technologies, IKVM.NET stands in the unique position of bringing them together. Initially born out of frustration with the limitations of tools like JUMP and J#, IKVM.NET was created when Jeroen Frijters set out to create a way to migrate an existing JavaTM database application to .NETTM.

IKVM.NET has gone through a variety of designs and name changes to emerge as a sophisticated collection of tools offering a variety of integration patterns between the Java and .NET languages and platforms. It is still under development but people have reported success in running sophisticated applications and tools including Eclipse, JmDNS, JGroups, Jetty (with a few changes), etc.

This manual is written for IKVM.NET version 0.80.

Overview

There are two main ways of using IKVM.NET:

  • Dynamically: In this mode, Java classes and jars are used directly to execute Java applications on the .NETTM runtime. Java bytecode is translated on the fly into CIL and no further steps are necessary. The full Java class loader model is supported in this mode.

  • Statically: In order to allow Java code to be used by .NET applications, it must be compiled down to a DLL and used directly. The bytecode is translated to CIL and stored in this form. The assemblies can be referenced directly by the .NET applications and the "Java" objects can be used as if they were .NET objects. While the static mode does not support the full Java class loader mechanism, it is possible for statically-compiled code to create a class loader and load classes dynamically.

IKVM.NET provides the VM-related technologies for byte-code translation and verification, classloading, etc. It is dependent upon the GNU Classpath project for implementations of the JDK libraries. While there are several holes in the coverage provided by these libraries, they are used by at least ten open source VMs. This means that they will continue evolving and being debugged rapidly to improve the quality of the IKVM.NET experience.

IKVM.NET is comprised by the following components:

IKVM.NET Components
Component Description
IKVM.Runtime.dll The VM runtime and all supporting code. It contains (among other things):
  • Byte Code JIT compiler/verifier: Just-in-time compiles Java Byte Code to CIL.

  • Object model remapping infrastructure: Makes System.Object, System.String and System.Exception appear to Java code as java.lang.Object, java.lang.String and java.lang.Throwable.

  • Managed .NET re-implementations of the native methods in Classpath.

IKVM.GNU.Classpath.dll This is a compiled version of GNU Classpath, the Free Software Foundation's implementation of the Java class libraries, plus some additional IKVM.NET specific code. Note that GNU Classpath isn't part of IKVM.NET, but it is used by IKVM.NET.
IKVM.JNI.CLR-Win32.dll Managed C++ assembly that implements the JNI interface. This is an optional part, only required when an application uses its own native libraries. This is not needed for pure Java applications.
IKVM.JNI.Mono.dll Mono implementation of the JNI interface. Works together with libmono-ikvm-jni.so, which is developed and maintained as part of Mono.
IKVM.AWT.WinForms.dll Very limited and broken implementation of a few AWT peers. This is a low priority issue until the platform stabilizes and works sufficiently well.
ikvm.exe Starter executable, comparable to java.exe ("dynamic mode").
ikvmc.exe Static compiler. Used to compile Java classes and jars into a .NET assembly ("static mode")
ikvmstub.exe A tool that generates stub class files from a .NET assembly, so that Java code can be compiled against .NET code. IKVM.NET understands the stubs and replaces the references to the stubs by references to the actual .NET types.

System Requirements

You must have one of the following .NET frameworks installed:

  • Microsoft .NET Framework 1.1 SDK (Windows platform)
  • Mono Framework 1.0 (Windows or Linux)
by Stephen Schaub, Brian J. Sletten