BT

Java 1.5 for the .NET Platform

by Jonathan Allen on Dec 15, 2008 |

Ja.NET is a port of Java 1.5 SE to the .NET platform. The compiler is based on the Eclipse JDT, which has been modified to generate IL as well as Java Byte Code. Java traditionally compiles each class into a separate file, but this creates an unacceptable overhead for .NET. To address this, a tool based on Cecil is used to create larger assemblies much in the same way Jar files are created for Java.

In order to get a head-start on library support, the Ja.NET JDK is based on the open source project Apache Harmony. Dave Tillman writes,

One thing that attracted me to Harmony, as opposed to the OpenJDK, is the libraries in Harmony are already organized nicely into modules. For example, you’ll find a LUNI module which stands for Lang-Util-Net-Io, a NIO module, etc. BTW, as a side note, I actually began working with OpenJDK and actually have a running version of that as well on my machine, but chose to switch to Harmony a while back.

When we talked to Dave, he gave InfoQ some more details on what that entails,

At this point the Ja.NET SE project is solely focused on Java SE. Providing a Java 5 JDK for .NET. Before moving higher up the stack (Java EE), I think we need to get SE done, and done right. All of the Java 5 SE libraries are included in the distribution, BUT, not all of them are fully functional. You see I'm basing the work on several upstream projects (see my lateset blog for some details - www.janetdev.org). The biggest is the Apache Harmony project. Harmony has developed code for most all (99.x%) of Java 5 SE class libraries, including Swing, AWT, etc. They also have Java ME and Java 6 code as well.

The Ja.NET SE class libraries are derived from the Harmony code, and today I build all of the code from Harmony into assembies for .NET and include them in the distribution. BUT not all of the work of modifing the class library code to tie it into cooresponding .NET/CLR services has been completed at this point. For example, the work to tie Swing and AWT into WPF has not been done ... that's why I'm looking for contributors ;-). To do this, a person would have to take the Swing/AWT code base that is already provided by Harmony, rip it appart and add calls to the WPF API's at the appropriate places in the code. All of the Harmony Swing/AWT code already compiles to .NET assemblies, it just isn't hooked into WPF yet. 

So, what is there. Well, enough of the core libraries (reflection, concurrency, class loading, io, nio charsets, etc.) are there that the Ja.NET SE tools (compiler, assembly merger, run on .NET. Also, I've got enough there that JUnit 4.3/4.5, Xerces 2.8, Ant 1.7.0 are working on .NET without any code changes. And, of course I'm adding more and more daily! :-)

Ja.NET currently runs on both Microsoft's CLR and Novell's Mono platform.

Hello stranger!

You need to Register an InfoQ account or to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

sounds similar to J# by peter lin

the project sounds very interesting. looks like an open source version of J#.

current release has some bugs by 董 平雷

Current release version ,can't run some big java software,etc:netbeans....

Re: sounds similar to J# by Ben Bowen

I think the big difference is that J# does not compile to Java Bytecode, so will not run on a JVM, where this compiles to Bytecode as well as MSIL so it can run in both envoronments. (from my understanding of this article)

Re: sounds similar to J# by Jonathan Allen

True. But if you are committed to writing JDK-compliant code, then you can safely recompile using a normal Java compiler.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

4 Discuss

Educational Content

General Feedback
Bugs
Advertising
Editorial
InfoQ.com and all content copyright © 2006-2013 C4Media Inc. InfoQ.com hosted at Contegix, the best ISP we've ever worked with.
Privacy policy
BT