According to Hoyle...
Cross-Platform Software Development from a Macintosh Perspective: Java Development Environments
by Jonathan Hoyle
April 2006
Last year, we began our series on cross-platform software development for the Macintosh, covering a number of development environments and frameworks:
In this month's column, we review the state of Java compilers and IDE's for the Macintosh developer.
Java: The Preeminent Cross-Platform Development Platform
Unless you have spent the last 10 years as a prisoner of Azkaban, you have no doubt heard of Java. Developed by Sun Microsystems to be an object oriented language loosely based upon C++, Java has quickly grown to be one of the most popular programming languages. With built-in garbage collection, Java sheds C++'s pointer weaknesses of memory leaks and access errors. Most importantly, the designers created the Java Runtime Environment (JRE), allowing Java applications to run on any platform that supports the JRE.
It is important to remember that there are two sides to Java: the front end Java programming language, and the back-end Java byte code which runs in the JRE. Although they are typically found together, there are commercial packages in which they are separated. For example, Microsoft's Visual J# development environment compiles the Java programming language into the .NET intermediate byte code instead of Java byte code; a reverse example is Axiomatic Multi-Platform C (reviewed last month) which compiles the C programming language into Java byte code.
A more insidious example of this difference is the (now defunct) product Visual J++, Microsoft's Java compiler, which failed to be fully cross-platform (many apps it created ran only on Windows). This, along with a number of other Microsoft misdeeds with respect to Java, led to a lawsuit with Sun Microsystems. In the end, Microsoft paid $20 Million in damages to Sun and was further legally compelled to make necessary changes in Visual J++. Microsoft did so, and then subsequently (and unceremoniously) killed the product, replacing it with Visual J#.
In this article, we shall review only those Java development environments which are fully compliant (both front end and back end), and that can be hosted on Mac OS X.
Free Java Development Environments
Not all Java compilers are created equal, at least not from a Mac OS X perspective. Sun provides a free Java compiler called javac, and IBM provides a highly optimized one named jikes. Each of these, however, is a command line interface compiler and thus requires you to run it inside the Terminal application. Although they are both good compilers, console applications do not provide an acceptable Macintosh user experience.
Xcode
Fortunately, Apple comes to the rescue here with Xcode, the free IDE that comes with Mac OS X. Xcode can wrap either javac or jikes, allowing you to build Java applications. With its code completion and enhanced debugging capabilities, Xcode is an excellent platform for Java development on the Mac. However, because Xcode itself is Mac-only, the only way to debug on Windows or Linux is through remote debugging. This is a less than optimal way to develop cross-platform code.
NetBeans
There are two other free (and, in fact, Open Source) Java IDE's, which are themselves written in Java. One is NetBeans, a very popular open source Java programming environment. NetBeans has a built-in GUI builder, code completion, code folding and much more. Its feature set is rich and far more powerful than that found in Xcode. Unfortunately, its GUI is still a bit immature from a Mac perspective. The most obvious sign of this is its application menu bar being attached to the window, as opposed to being at the top of the desktop. This is a common problem found in applications written by Java developers who think of their Mac clients as afterthoughts.
Eclipse
A better choice, and the one recommended for those looking for a free IDE, is Eclipse. Eclipse has most of the features that NetBeans has, plus a cleaner Mac OS X user experience. Eclipse also has a great feature called code refactoring, the ability to make global changes to your code when changing the name of a method, variable or even modifying a function parameter list. Although NetBeans has recently added this to its feature set, code refactoring remains more mature in Eclipse. Furthermore, the user interface, besides being more Mac friendly, is also a lot more intuitive and easy to navigate. It has also begun to capture a huge chunk of the Java marketshare. By all accounts, Eclipse is the leader in the freeware Java arena.
Commercial Java Development Environments
With the number of high quality freeware options for Java on the Mac, the need for a commercial Java package may seem a bit limited. With CodeWarrior dropping out of the Mac and Windows development arena, coupled with Apple's big push to their own free tools, there are essentially two compilers left standing in the commercial world for Mac-hosted Java: JBuilder by Borland and IDEA by JetBrains. Each retails for $499.
JBuilder
Shortly following the release of Mac OS X in 2001, Borland returned to the Mac development community with JBuilder, after an absence of nearly 15 years. Borland won a large number of awards for this product, particularly for its ease of development. Supporting all of the latest standards, JBuilder quickly became a dominant IDE for Java, on both Windows and Mac OS X. Borland even made appearances at Apple's Worldwide Developer's Conference, making inroads into the Mac-hosted software development field. Not since its introduction of Turbo Pascal for the Macintosh back in 1986, had Borland had such a presence in Mac development. However, this tide began to turn in 2003 and 2004, when the popular (and free) Eclipse began to erode JBuilder's marketshare. About a year ago, Borland finally gave into the competition by announcing that its future roadmap will include integrating JBuilder with Eclipse. Although JBuilder 2005 is specified to run on a 800MHz Mac G4 and higher, the system requirements for its most recent release, JBuilder 2006, no longer includes the Macintosh.
IDEA
For the best Java compiler available today, the hands-down winner is IDEA. IDEA is similar to Eclipse from a feature checklist perspective, but IDEA does it more easily and more intuitively. Despite how nice Eclipse is, it appears clunky when compared with IDEA. IDEA takes fewer keystrokes to do most of the same tasks, and the workflow appears smoother. Its interface is more easily discoverable as well. Its GUI builder is also very intuitive and very powerful. The benefits of IDEA are harder to describe than they are to show, so I would encourage anyone interested should download the demo from their web site.
Conclusion
Each of the packages discussed in this article are very good Java environments, so from that perspective, you really can't go wrong. However, Eclipse has taken on the Java world by storm and is likely to come out the clear winner in marketshare. It is one of the best freeware IDE's ever made available, and is better than most commercial ones. The only product better is IDEA, which excels above and beyond and Java IDE before it. IDEA is the best of the best and is this author's recommendation for Java development.
Next Month: Development Environments for BASIC.