Early last month I wrote an article about Java application frameworks being ported to .NET. The piece caused a bit of commotion on our sister site TheServerSide.net, and it also brought to my attention a related project.
All of those ports start with the idea that it’d be nice to use established Java frameworks and paradigms in .NET and come up with the natural solution, which is to port the software. But there’s another approach, too: why not just compile those existing frameworks to work with .NET’s CLR?
That’s the idea behind Ja.NET SE, an open source project based on the Apache Harmony compiler for Java. Instead of targeting Java bytecode, Ja.NET compiles to Microsoft’s Common Intermediate Language (CIL), which the .NET runtime then consumes natively.
Ja.NET is already fairly well along. Its lead programmer Dave Tillman says it can already compile itself and create assemblies out of .class files. Still missing are Java’s SWING and AWT classes for building GUIs and a SQL module, which Tillman said he’d like to see modified to work with ADO and ADO.NET. Tillman said he’s hoping more developers will step up and contribute to the project.
If Ja.NET catches on, Tillman said, projects like Spring and Hibernate won’t have to fork off .NET-specific siblings. Instead, .NET developers will be able to use the existing Java frameworks by just recompiling them.
The project could also simply projects that currently tap into Windows’ functionality through the Java Native Interface (JNI). For instance, the popular open source IDE Eclipse, which is written in Java, uses JNI to access WPF so that it can have a native look and feel on Windows, Tillman said. That means not just more code, but also more runtime overhead, since it uses both the JVM and .NET’s CLR. If Ja.NET is successful, Eclipse’s developers could instead compile the whole project to CIL and do away with the need to have the JVM and CLR communicate, Tillman said.