In a surprising move, Microsoft Corp. recently released the latest addition to the .Net constellation of programming languages: J#, pronounced J sharp. Although J# is not Java, it is a full implementation of Sun Microsystems Inc.’s Java language specification and will run many existing Java applications after a simple recompile or binary conversion. But J# code neither runs in a Java VM (Virtual Machine) nor leverages run-time features created after Version 1.1.4 of Sun’s Java SDK (software development kit). Microsoft is banking that the differences between Java and J# will be obvious to lawyers and judges – and that J# will give Java serious competition for the minds of Java developers.
Microsoft has two goals for J#: rescue marooned Visual J++ developers and give other Java coders an easy path to the .NET platform. By promising to match VJ++’s feature set, and most of that promise is realized in this beta, J# gives VJ++ users a soft place to land. Microsoft will have a more difficult time convincing Java developers that they can live without J2EE (Java 2 Enterprise Edition), JDK (Java Development Kit) 1.2 and 1.3 compatibility, and platform independence. The alluring VJ++ environment enticed many programmers to write Java applications that ran only on Windows. Can J# work the same magic for .NET?
The first beta release of J# plugs into Visual Studio.Net Beta 2, rather than the release candidate. As does other .NET languages, J# compiles to MSIL (Microsoft intermediate language). The J# compiler will not generate Java-compiled byte code (class) files, so it is impossible to run a J# application outside of .Net. You also cannot use compiled Java class files in J# projects because the .Net run time does not understand Java byte code. If you do not have the source code for the Java classes you use, you would be out of luck if not for Microsoft’s byte-code converter.
This clever utility translates Java byte code into MSIL, making compiled Java code run on .NET. Such translation cannot be done at run time; you run the converter during development for each Java class you plan to use, turning the class into a .NET assembly that can be called from J# or any other .NET language. The conversion process is fast, and the converter accepts wild cards and traverses subdirectories to make batch conversion of a collection of Java classes easy.
We found that J# compiled all of the non-J2EE Java code we ran through it without modification, as long as we avoided using features of Version 1.2 and later JDKs. Microsoft supplies assemblies that provide the functionality of Sun’s JDK 1.1.4 without using any Sun code, thus avoiding Sun’s control and, Microsoft hopes, its legal wrath. J# also implements VJ++ extensions to Java, including COM (Component Object Model) object support and the J/Direct native code interface, making it easy to migrate VJ++ projects to J#. We opened several VJ++ sample projects in Visual Studio.NET Beta 2 and converted them with a simple recompile. The degree of VJ++ compatibility is impressive for a beta.
Our experience with the J# beta was mostly positive, allowing for its narrowly defined mission and limitations. It gets high marks for VJ++ migration, and the final release will likely render effortless transplanting even large VJ++ projects to the .NET platform. For .NET development, J#’s primary audience is hard-core Java coders who must target .NET, but who would rather live with J#’s limitations than switch to the more expressive and accommodating C#. But, despite our fondness for Java, nothing in this beta sways us from our preference for C# for .NET applications.
Yager (email@example.com), the InfoWorld (U.S.) Test Center technical director has coded and managed projects in a number of languages.