Visual MainWin offers best of .Net, Java

When I first heard about Mainsoft's Visual MainWin for J2EE, I thought the concept was a harebrained idea. Just skimming some of the product's help topics sent me reeling: "Developing ASP .Net applications on J2EE." Give me a break.

Experimenting with the product put my sarcasm through a cleansing acid bath: If Visual MainWin for J2EE is a harebrained idea, it is the best-executed harebrained idea I've seen.

In a nutshell, Visual MainWin turns .Net applications into Java applications. But Visual MainWin for J2EE allows you to build ASP .Net apps -- ones that use ADO (ActiveX Data Objects) .Net -- and convert them to J2EE apps, deploy them to and debug them on J2EE app servers, and do it all from within Visual Studio .Net.

Visual MainWin for J2EE installs as a plug-in to the Visual Studio .Net IDE (integrated development environment). It also installs the included Tomcat 5.0 application server, which becomes the test bed for ASP .Net apps transformed into J2EE apps.

The word seamless has become nearly meaningless, but Visual MainWin's integration into Visual Studio deserves the label. Visual MainWin attaches itself to the output of the compilation process and translates the IL (intermediate language) code coming out of Visual Studio into the equivalent Java bytecode. It packages the code into the proper archive file, depending on the target app server, and deploys the archive to the app server, along with Java versions of the ASP .Net and ADO .Net libraries.

Thus, MainWin turns Visual Studio .Net into a "develop, debug, and deploy" IDE for J2EE apps, with the peculiar twist that those apps can be written in VB (Visual Basic) .Net or C#.

Aside from the Visual MainWin project templates added to Visual Studio, you hardly know Visual MainWin is there. You can use all the server-side controls from ASP .Net. ADO .Net is implemented on top of JDBC, and the latest release of Visual MainWin provides a generic database connection.

What's even more amazing is that the product wires the bytecode back to the .Net source for debugging purposes; you can single-step through C# or VB .Net source as Java bytecode executes. Not only is the translator converting IL code to bytecode, it's preserving the debug information -- an unexpected plus.

Visual MainWin does its best to map .Net entities to Java equivalents but must sometimes make exceptions -- for example, in the case of exceptions. Java provides one exception class, but .Net provides three; Visual MainWin is forced to map all three .Net exceptions to the single Java exception. There's no easy fix; you simply have to write around this many-to-one mapping.

Although all .Net exceptions are derived from the System.Exception class, not all Java exceptions are derived from java.lang.Exceptions; some generated by the JVM (Java Virtual Machine) are derived from the java.lang.Error class. This incongruence shows up in .Net code that tries to catch all exceptions. When translated into Java, exceptions derived from java.lang.Error slip by.

This is where Visual MainWin's conditional compilation constants -- JAVA and NET -- come in handy. JAVA is true when the output of compilation is Java bytecode, and NET is true when the output is Microsoft IL. Use of these compilation constants allows you to create platform-agnostic source code. You can even import EJB references into a .Net project and call EJBs from VB .Net or C# code with Mainsoft-supplied wrapper code.

Visual MainWin for J2EE is remarkable; it is clever and smooth, and the exception-related write-arounds are but minor annoyances. At the very least, this opens the world of Linux to ASP .Net apps, and those results will be very interesting to watch.

Join the newsletter!


Sign up to gain exclusive access to email subscriptions, event invitations, competitions, giveaways, and much more.

Membership is free, and your security and privacy remain protected. View our privacy policy before signing up.

Error: Please check your email address.
Keep up with the latest tech news, reviews and previews by subscribing to the Good Gear Guide newsletter.

Rick Grehan

Show Comments





Back To Business Guide

Click for more ›

Most Popular Reviews

Latest Articles


PCW Evaluation Team

Christopher Low

Brother RJ-4230B

This small mobile printer is exactly what I need for invoicing and other jobs such as sending fellow tradesman details or step-by-step instructions that I can easily print off from my phone or the Web.

Aysha Strobbe

Microsoft Office 365/HP Spectre x360

Microsoft Office continues to make a student’s life that little bit easier by offering reliable, easy to use, time-saving functionality, while continuing to develop new features that further enhance what is already a formidable collection of applications

Michael Hargreaves

Microsoft Office 365/Dell XPS 15 2-in-1

I’d recommend a Dell XPS 15 2-in-1 and the new Windows 10 to anyone who needs to get serious work done (before you kick back on your couch with your favourite Netflix show.)

Maryellen Rose George

Brother PT-P750W

It’s useful for office tasks as well as pragmatic labelling of equipment and storage – just don’t get too excited and label everything in sight!

Cathy Giles

Brother MFC-L8900CDW

The Brother MFC-L8900CDW is an absolute stand out. I struggle to fault it.

Luke Hill


I need power and lots of it. As a Front End Web developer anything less just won’t cut it which is why the MSI GT75 is an outstanding laptop for me. It’s a sleek and futuristic looking, high quality, beast that has a touch of sci-fi flare about it.

Featured Content

Product Launch Showcase

Don’t have an account? Sign up here

Don't have an account? Sign up now

Forgot password?