18

IKVM is an amazing beast that lets me execute Java jars in a .NET environment. That is, it's a JVM written on the .NET runtime (CLR).

Does the opposite exist? Has someone written a CLR on top of a JVM? With suitable translation and base class library implementation, we might find .NET code executes more quickly in an aggressive JIT compiler, like HotSpot, than in the CLR JIT.

Sebastian Good
  • 6,310
  • 2
  • 33
  • 57
  • 1
    Never heard of IKVM, just checked it. Great, thanks for the question ;-) – Horst Walter Jul 13 '11 at 22:38
  • 2
    The CLR JIT is hardly "unoptimized" and it takes advantage of many features that are part of MSIL *but not* Java Byte Code. I doubt that, in general, there would be any *performance* advantage gains to be had. If anything, the opposite seems much more likely. Also, the language in this post is ... highly opinionated and inflammatory at the end. –  Jul 13 '11 at 23:02
  • 1
    @pst- you are right. The CLR JIT does plenty of optimizations, so I have edited the question to be less, well, exciting. That said, I'm not aware that the CLR JIT does incremental optimization, e.g. replacing function calls or bodies with ever more performant code as the program executes. – Sebastian Good Jul 14 '11 at 22:51

2 Answers2

2

You can call COM or ActiveX componenets usuing JACOB (Java COM Bridge) . That what I used only time I had to call my C# code from JAVA . Also check this link from StackOverflow How can I call .NET code from Java? Also googled this http://michaelkimsal.com/blog/running-net-code-on-a-jvm/

Community
  • 1
  • 1
Shahzeb
  • 4,745
  • 4
  • 27
  • 40
  • Mainsoft Grasshopper (http://dev.mainsoft.com/Default.aspx?tabid=130) and JaCIL (http://sourceforge.net/projects/jacil/) are the two I'm aware of. – Brett Kail Jul 14 '11 at 00:22
2

The most Java programs run with IKVM (32 bit) a little faster as with Java SE. My test show 5-10% faster. That I think that MSIL code would be run slower with a HotSpot JIT.

The next problem is that MSIL has many more features as Java byte code. It can be difficult to emulate it and it consume performance.

With Mainsoft Grasshopper you have a solution that work on a Java EE server. I does not know a solution for a desktop GUI.

Horcrux7
  • 23,758
  • 21
  • 98
  • 156
  • It are a large programs. A web server based on the Jetty. It use File, JDBC, Font and Graphics API intensively. You will ever find code that is faster with the one or the other. We have not make an intensive test. It was enough to see that our program run faster with IKVM. I think that an important part must be better implemented. For example native calls or synchronized. It must not the JIT self that it better. – Horcrux7 Jul 15 '11 at 11:01