There are two recommended paths for moving Java applications to the .NET Framework: upgrade them to Visual J# .NET, or convert them to Visual C# .NET. Each approach requires a different effort, and each has different benefits as outlined below. Both approaches also mean moving the application to Microsoft Windows, since the full version of the .NET Framework is available only for Microsoft Windows.
Although conversion from Java to the .NET Framework can be performed using the .NET Framework SDK, using the command-line compilers for Visual C# .NET, Visual Basic .NET, and Visual J# .NET, the remainder of this document assumes the developer is using Visual Studio .NET to move applications to the .NET Framework.
Upgrade to Visual J# .NET:
Visual J# .NET is an implementation of the Java language for the .NET Framework. It is available from MSDN’s Visual J# site.
Developed independently by Microsoft, J# compiles Java language code to MSIL. Visual J# .NET consists of a Java language compiler and class libraries designed to provide the functionality equivalent to most of the JDK level 1.1.4 packages. The classes in the java.util package support functionality equivalent to JDK level 1.2 class libraries and classes in the Microsoft Supplemental UI Library for Visual J# provide much of the functionality as described in the Java 2 JFC Swing specification. It also consists of a tool to upgrade compiled Java byte code to MSIL—useful for upgrading libraries to a form that can be used from .NET Framework-based applications. In addition, like other .NET-compliant languages, Visual J# .NET has full access to the .NET Framework, and includes designers for Windows Forms and ASP.NET Web Forms development.
In many cases, especially where business logic preservation is a goal, upgrading to Visual J# .NET is the easiest and quickest way to move Java applications to the .NET Framework. With a familiar syntax and set of class libraries, developers can leverage their existing knowledge of Java, and become productive on the .NET Framework immediately. Applications upgraded to Visual J# .NET are in a position of instant benefit: The upgrade is very quick, and developers can begin to add features made possible with the .NET Framework and Microsoft extensions to the Java language. The Java to Visual J# .NET Upgrade Wizard is invoked by opening a Visual J++ 6.0 project with Visual Studio .NET.
Convert to Visual C# .NET:
The Java Language Conversion Assistant (JLCA) is available for download from the Java Language Conversion Assistant site. The Java Language Conversion Assistant converts Java applications to Visual C# .NET. Code that calls Java APIs is converted to comparable C# code that uses the .NET Framework. Because of the complexity of the conversion, not all Java APIs are converted. The Java Language Conversion Assistant converts about 90 percent of JDK and J2EE level 1.3 calls, EJB, JAAS, JCE, JMS, JNDI, RMI, and JAXP, and emits issues in code for the other 10 percent. Each issue is linked to a topic with guidelines for what modifications to make to finish the conversion.
Applications converted from Java to C# are in a position of maximum flexibility: Although converting to C# is generally more labor-intensive than upgrading to Visual J# .NET, it offers more opportunity because the application is converted to use the native .NET Framework APIs. After the modifications are made, converted code will immediately take advantage of the improved performance, scalability, security, and versioning of the .NET Framework, just as with Visual J# .NET.
Unlike Visual J# .NET, the Java Language Conversion Assistant supports conversion of Visual J++ 6.0, loose-file, and directory-based projects. The Java Language Conversion Assistant is invoked by choosing File, then Open, and then Convert… from the Visual Studio .NET menu.
To obtain the latest version of the Java Language Conversion Assistant, visit the MSDN site here. Version 3.0 of the Java Language Conversion Assistant is in beta at the time of writing of this article, but the beta quality is very high and produces better results than versions 1.0 and 2.0.
Technologies with No Automatic Migration:
Both Visual J# .NET and the Java Language Conversion Assistant target the Java Language, supporting conversion from JDK 1.1.4 and J2EE v1.3, respectively. In addition, Visual J# .NET supports the Microsoft libraries that shipped with Visual J++ 6.0, and both Visual J# .NET and the JLCA support a few extensions beyond that base. Some Java applications that use technologies from later versions of Java may require some additional modifications to migrate them to the .NET Framework. This is usually very simple: After migration, the greater part of the application (business logic and JDK level 1.1.4/1.3 classes as appropriate) will have migrated perfectly. The unsupported technologies will be left unchanged in the migrated code. To finish the migration, you replace the unmigrated Java technology with comparable Microsoft .NET technology. Because the .NET Framework provides a richer set of classes than what is available in Java, often you can make some significant enhancements when performing the technology replacement
Choosing Between J# and C#:
Deciding which .NET-compliant language to migrate your Java applications to is predominantly a matter of personal choice. As discussed earlier, both Visual J# .NET and Visual C# .NET compile to the same MSIL, both languages have access to the same .NET Framework, and both languages offer relatively similar capabilities.
To help you with making the choice, here are three major determining factors to consider when choosing between upgrading to Visual J# .NET and converting to Visual C# .NET:
No comments:
Post a Comment