LJ Archive

Transvirtual Adopts Microsoft Java Extensions

Craig Knudsen

Issue #66, October 1999

Mr. Knudsen tells us why this company chose to add MS extensions to Kaffe, the open-source Java implementation.

Kaffe, first released in 1996, was the original open-source Java implementation. Initially developed as part of another project, it grew so popular that developers Tim Wilkinson and Peter Mehlitz founded Transvirtual Technologies, Inc. with Kaffe as the company's flagship product. In July of 1998, Transvirtual released Kaffe OpenVM under a GNU license.

Kaffe's multi-platform support and small footprint have attracted many users. On-line magazine JavaWorld gave Kaffe their Editors' Choice Award for Best Virtual Machine for 1998, stating, “Java has been waiting for Kaffe for a long time. A proper open-source, cross-platform JVM, free of restrictive licenses, is a must for the complete acceptance of Java.” Kaffe was originally released as source code long before the term “open source” had been coined. It was the first Java Virtual Machine (JVM) for many operating systems and was also one of the first to offer a Just-In-Time (JIT) compiler for many architectures, improving Java's runtime performance.

Microsoft's Java extensions have created a good deal of controversy. Sun claims that Microsoft violated the terms of its Java licensing agreement and has filed a highly publicized lawsuit. Microsoft's version of Java was not “write once, run anywhere” as Sun intended Java to be. To much of the Java community, it appeared as though Microsoft was attempting to splinter Java with extensions like J/Direct and new Java keywords (“delegate” and “multicast”) that gave Java developers new capabilities not otherwise available in Java. Applications using these extensions are required to use Microsoft's JVM.

At first look, it may seem surprising that a company known for its open source, clean-room implementation of Java would add support for Microsoft extensions to the language. However, by adding support for these extensions to Kaffe, Transvirtual is allowing Java programs developed under Windows (using Microsoft Visual J++) that make use of the extensions to run on non-Windows platforms such as Linux, FreeBSD and Solaris. Additionally, Transvirtual is providing a new source for Java on the Windows platforms.

The first extension Kaffe supports is delegates. The delegate keyword essentially provides a function pointer. This allows an application developer to tie an event to a specific user interface element (such as a push button). Microsoft added the new “delegate” keyword to the Java language to support this. (At the time delegates were introduced, Java was at level 1.0.2 and had not yet introduced the new 1.1 event model which provides similar capabilities.) Microsoft Visual J++ is required in order to compile the Java code if you make use of the delegate keyword. Up until now, you also had to use Microsoft's JVM to run the compiled Java application. Kaffe's support for this extension allows non-Windows users to run Java code that makes use of the delegate extension. For now, you will still need to compile your application with Visual J++. But, you can deploy the compiled Java code on Linux or any other Kaffe-supported platform.

Delegates is only the first extension that Kaffe will support. Microsoft's J/Direct provides similar functionality to Sun's JNI, giving developers access to application-specific functions. Why would anyone choose J/Direct over JNI? According to Transvirtual founder and CEO Tim Wilkinson, “I wouldn't primarily expect UNIX users to pick these extensions up and run with them, but since Windows users are using them, I don't want them marooned on Windows-NT for the rest of their natural lives. J/Direct support, in particular, makes it far simpler to move Java code which uses an application-specific native library to UNIX.” Wilkinson went on to say that J/Direct “provides similar functionality to JNI in, as far as I'm concerned, a much cleaner fashion.”

Although funding was supplied by Microsoft to add these extensions to Kaffe, the relationship was initiated by Transvirtual. Transvirtual wanted to give users the freedom to choose a non-Microsoft platform even if they developed their code with Microsoft tools. Microsoft made documentation available on their web site (see Resources), but did not contribute any code or other intellectual property. One of the conditions of Transvirtual's support for the extensions was that the result would be released as open source under the GNU GPL.

Why would Microsoft be interested in open-source implementations of their Java extensions? Sun's lawsuit against Microsoft has placed the future of Microsoft's Java implementation in jeopardy. The extensions added to Kaffe are at the heart of the lawsuit. Many companies are beginning to look for a second source for Java. A version of Kaffe for Windows with AWT 1.1 and native threads support was scheduled to be released in late July.

By supporting delegates (and eventually J/Direct and Java/COM), Transvirtual has made it possible to take code developed using J++ and deliver it to Linux. One of the great strengths of Linux is its interoperability with other operating systems. By providing this technology to the Linux community, Transvirtual has added to this strength.

Resources

Kaffe OpenVM's Supported Platforms

Craig Knudsen (cknudsen@radix.net) lives in Fairfax, VA and telecommutes full-time as a web engineer for ePresence, Inc. of Red Bank, NJ. Craig has been using Linux for both work and play for three years. When he's not working, he and his wife Kim relax with their two Yorkies, Buster and Baloo.

LJ Archive