Browse DevX
Sign up for e-mail newsletters from DevX


JLCA Ports Legacy Java Code to .NET : Page 3

The Java Language Conversion Assistant (JLCA) enables developers to port legacy Java code to the .NET world. Get an introduction to this tool, along with an explanation of its installation and conversion processes.




Building the Right Environment to Support AI, Machine Learning and Deep Learning

Conversion Time
Start the JLCA. The wizard first prompts you to specify whether the Java code to be converted is an existing Microsoft J++ project or a directory of Java source code files (you can convert multiple paths in one process). One problem is you cannot choose individual files within a directory. Therefore, a directory containing multiple individual Java programs, each with its own main method, can result in conversion confusion as the JLCA pools them all into one resultant C# app.

The wizard next asks which type of C# project to create (Windows application, Web application, or others), what name to give the project, and where to find its output directory. And that's all! Click "Finish" and the JLCA powers along by itself.

Despite the simple preceding steps, the conversion is a sophisticated process. It doesn't just convert files one-by-one, merely substituting Java methods and library calls for their .NET equivalents. Rather, the JLCA carefully and intelligently analyzes the body of code to be converted and performs large-scale architectural rewrites. For instance, it converts:

  • Enterprise Java Beans (EJB) into COM components
  • AWT and Swing forms into Windows (or Web) forms
  • Remote Method Invocation (RMI) calls into .NET remoting calls

Figure 5: Conversion Process in Progress

Figure 6: The JLCA Has Done the Bulk of the Work

At completion, the JLCA gives a status report showing the total number of "issues" (warnings, errors, and the like) it found. The bulk of these findings are purely "just in case" alerts. For example, method calls may work slightly differently between C# and Java, in which case you need to check the "before" and "after" calls. However, the likelihood is that all the converted code will perform as expected except in rare situations.

The generated output code is clean and functional, and it demonstrates no trace of its Java origins. The JLCA intersperses comments wherever it raises issues, and these handily tie in with the IDE's "To Do list" functionality, meaning you can easily find them.

Figure 7: Issues the JLCA Reports Are Likely Insignificant

Figure 8: Transported Java App with No Trace of Its Origins

Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date