First Look at Microsoft J#.NET Beta
By Matt Liotta, Engineering Manager, and Lori Piquet, Editor-in-chief
We got an early look at the first beta of Microsoft J#.NET, which allows you to write .NET applications and services using Java language syntax. Find out what Java developer and DevX Engineering Manager Matt Liotta had to say about the latest addition to the Visual Studio.NET language family.
Recently, DevX got a rare opportunity to see an unannounced Microsoft product, J#.NET, in beta, when links to the product were temporarily made live on the Microsoft Web site. Though these linkseither the result of an error or an intentional leak by Microsoftwere subsequently removed, the product was officially announced and a download of the beta made available by Microsoft on October 10.
J#.NET represents the first development tool on the marketplace that will allow developers to write native .NET applications and services using Java language syntax. Since the legal battle over Java between Sun Microsystems and Microsoft was settled, forcing Microsoft to cease further distribution and development of its Visual J++ IDE, the opportunity for developers to easily write Java language applications that integrate tightly with COM and the various Windows operating systems has dwindled. J#.NET appears to be a major attempt by Microsoft to recapture some portion of the Java developer base, giving these developers a tool to write applications in the language they prefer, while compiling natively to Microsoft's .NET Common Language Runtime (CLR), and thereby conferring on them all the interoperability, reusability, and ease-of-use that the Visual Studio.NET environment promises to provide.
J# is really no different than any of the other .NET languages, such as Visual Basic.NET or C#.NET. A J# application can make use of components created in other .NET languages. The reverse is also true; a C# or VB.NET application can make use of J# components. (To see some of the documentation for J#, view the Readme file from Microsoft.)
 |
|
Figure 1 | Visual J# integrated immediately with our installed version of the Visual Studio.NET Beta 2, and allowed us to begin creating J# projects as we would with other .NET languages.
|
We had no problems with the installation of J#; it integrated easily with our existing installation of the Visual Studio.NET Beta 2 (see Figure 1). Being already familiar with the VS.NET UI, we were able to begin using it to create J# projects immediately, and to compile them to the CLR.
Perhaps more interesting, we were able to migrate existing Java applications by making just a few simple modifications. For example, Figure 2 shows us working in VS.NET with an open Java project, a CFML (Cold Fusion Markup Language) parser. The parser doesn't make use of any specialized Java classes, but it is quite complex. When we simply added all the source code files into a new J# project and tried compiling it, it failed. However, after make a few very simple changes it compiled. We've never seen porting quite this easy before.
| |
 |
Figure 2 | Shown here is the code for an existing CFML (Cold Fusion Markup Language) parser, written in Java. We were able to port it easily into .NET using J#.
|
Theoretically, any Java application that doesn't make use of Java APIs can be migrated into J# and compiled to the CLR. Applications that use Java APIs such as RMI or JNI are not supported. Microsoft only explicitly supports the Java 1.1.4 specification. Further, the resulting binaries do not support any JVMthey will only compile to the .NET framework.
It appears that not all the vagaries of Java language syntax are supported, which is disappointing. For example, one of the most annoying problems is a stray semicolon error. In Java, you are allowed to have a semicolon after a curly brace block. J# does not seem to allow that. Additionally, J# seems to have some problems with method return types that have namespaces. However, these issues may simply be bugs that will be corrected prior to shipping.
The Readme file file contains a list of "Known Issues," in this first beta, including, surprisingly, the fact that Visual J++ projects that host ActiveX controls cannot be upgraded.
Many Java developers will also be frustrated by some of the behaviors of the .NET compiler, which can be quite different from standard Java compilers. For example, syntax that would normally generate a warning in a Java compiler instead generates an error in J#.
One of our favorite features of the product is the task list, which updates, in real-time, any syntax errors that are currently in the source code.
Many Java developers who program primarily in Java have at least investigated C#. Whether J# will be the tool that will bring some of these folks to .NET remains to be seen, but for those Java developers who have contemplated the foreboding task of porting existing Java code to C#, J# provides the answer that will save perhaps hundreds of hours of unenjoyable labor.
For those developers who sometimes write in Java and who have tried the VS.NET environment and liked what it had to offeras well as those developers who used, or still use, Visual J++J# will undoubtedly be a welcome announcement.
Many of the features that make VS.NET a great IDE are now available for the Java language, and, as with Visual J++ before it, a ready audience of developers, likely stands at the ready.
Copyright 2001 DevX.com, Inc.