Last week I tried JArchitect to analyse my java projects. After some tests I was curious to know which parser they use to analyze my jars, I contacted their support and they told me that they use Object Web ASM. My reply was:

Are you sure, Object wab asm is a set of jar files, and no jars exist in your install. Moreover the JRE is not required. How then do you use Object web asm.

The answer was that it works thought IKVM, which allows to use any jar file from .Net.

I decide to investigate further what IKVM is? And, what can provide as possibilities to collaborate between java and .Net?

IKVM.NET is an implementation of Java for Mono and the Microsoft .NET Framework. It includes the following components:

A Java Virtual Machine implemented in .NET

A .NET implementation of the Java class libraries

Tools that enable Java and .NET interoperability

IKVM.NET is useful for several different software development scenarios as indicated here , and I was more interested on how to use java libraries in .NET applications.

After googling I found this interesting web page that shows how to run Eclipse in a .Net virtual machine using IKVM. I followed the steps and to my great surprise it works.

If an advanced project like Eclipse works on IKVM, it must works for almost all other jars. As last test I decide to use one of my jar from .Net for that I needed just two steps

Generate the dll using the command « ikvmc -target:library mylib.jar « to create mylib.dll.

to create mylib.dll. Reference the dll generated in my .Net project.

And of course the IKVM dlls must be copied where your binaries exist.

What about performance?

There are some benchmarks to compare the performance of a jar executed using IKVM, for example you can refer to this one to have a concrete idea of the performance differences.

When to use IKVM?

It’s better to use .Net libraries from .Net, but in some cases it could be interesting to use IKVM: