jump to navigation

How Do You Marry Java and .NET? April 13, 2012

Posted by Peter Varhol in Software development, Software platforms, Software tools.
trackback

Years ago, I did some work for Mainsoft, which had a technically cool way of running .NET code on Java application servers.  This involved dynamically cross-compiling .NET into Java.  The idea was that you could create your application (typically a web application) using Visual Studio, then with a minimum of effort, configure it to run on a JVM and application server.

I would provide a link for Mainsoft, except that the company has changed names and markets (www.harmon.ie).  Apparently it wasn’t a good enough idea for a company to make money from.  Part of the problem was that there were two paths to getting .NET to run on Java – you either did byte code translation, or your implemented some or all of the .NET Common Language Runtime in Java.  Mainsoft did mostly the first, but also found that it was easier to use Mono classes for a lot of the CLR.

But now there seems to be a way to do it in the opposite direction; that is, running a Java application in .NET.

Mainsoft’s strategy was easily comprehendible but rather niche – developers were experienced in .NET and wanted to use the best .NET development tools possible, but the enterprise wanted flexibility in deployment.

IKVM, an open source project, uses some of the Mono classes to enable Java code to run on .NET.  It also includes a .NET implementation of some Java classes.  I’m not sure why Mono is needed in this case (and in fact, it’s likely that the Mono project has largely run its course).  IKVM lists three components to the project:

• A Java Virtual Machine implemented in .NET

• A .NET implementation of the Java class libraries

• Tools that enable Java and .NET interoperability

Microsoft was promoting IKVM during its language conference, obviously as an existence proof for the concept that there may be people who are interested in porting from Java to .NET in this manner.

Still, as a practical matter, it doesn’t seem worthwhile doing.  There are plenty of JVMs for Windows (I realize that .NET is a subset of Windows, but as a practical matter is pretty well tied to it).  The distinction of running on .NET is one that most won’t bother to make.  Perhaps someone out there can offer an explanation.

Advertisements

Comments»

1. Wayne Citrin - April 19, 2012

Hi Peter —

As I’m sure you’re aware, there are other approaches to getting Java and .NET to work together besides bytecode translation and porting the runtime. There’s also cross-platform bridging, like our JNBridgePro product. This approach has the advantage that each side runs in its own environment, with expected behavior and no surprises. With bytecode translation and runtime porting, there’s the issue that your legacy code becomes new code and there’s always the possibility it won’t behave as before.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: