July 27, 2001 -- It's been a busy six months for Apple. As promised, in March the company shipped Mac OS X with Java 1.3 installed as part of the OS. That fact alone makes the Mac a great target platform for deploying Java applications. Many of the sessions at Apple's Worldwide Developers Conference (WWDC) in May were led by the Java team who are improving Java's performance on the platform. Further, for the first time Sun Microsystems will incorporate some of Apple's innovations into future JVM releases. Moreover, Apple's message at June's JavaOne conference was summed up by its Java Technology Manager Alan Samuel: "We at least want you to target Mac OS X when you deploy your applications. After that, we want you to consider Mac OS X for your development." At last week's Macworld Expo in New York, you could see products doing just that.
Mac OS X and Java
Past Java-on-the-Mac articles in JavaWorld noted Apple's promised Java features in Mac OS X, as well as reviews of what features were in beta. Now that the OS is shipping, we can take a closer look.
Every Mac a Java 1.3 machine
Every Mac shipped today comes preinstalled with Mac OS X, each copy of which features Java 2, Standard Edition (J2SE) 1.3. By September, Apple will ship J2SE 1.3.1 with Mac OS X, and every current Mac OS X user will be entitled to a free upgrade. At the same time, Microsoft will ship its final version of IE 5.1 for Mac OS X that will include browser support for Java 2 applets. Both developments represent compelling reasons for Java developers to target Mac OS X: there is a single VM for the Mac, and the client already has it installed. Consequently, your application's downloads will be smaller.
Apple's Java performance twist
Apple has also improved the Java user experience by sharing libraries in an interesting way. Some of Java's performance improvements stem from smarter garbage collection. The idea: objects that have been around a while tend to stay around a long time, so they don't need to be polled quite as often. Apple, taking the idea further, looked at classes that remain unchanged between different applications. For example, two applications could share the same Swing code base. This sharing means that your second Java application will load much more quickly, and the total footprint will be smaller. Under this setup your first Java application's startup time remains quite slow, but this should improve with September's Mac OS X 10.1 release.
Java tools for the Mac
Because Apple built Mac OS X on top of Unix, you'll find your favorite command-line tools available to you. It's great to spot Sun employees and hardcore Java developers at conferences working away at Jini or server-side Java applications on their Titaniums. They usually have the terminal open (you can find the Terminal application in Applications/Utilities), and use either Emacs or vi along with javac. At May's WWDC, Apple CEO Steve Jobs said that by the end of the year, Apple would be the leading Unix provider. While you don't have to use the Unix tools, those who wish to will find BSD Unix with the enhanced C shell.
Furthermore, Apple now includes a developer's CD in every Mac OS X copy. With that move, every Mac hobbyist who wants to create an application has the tool support. Indeed, developers can use Apple's Project Builder IDE for developing Java applications, although, as a multi-language IDE, it does not provide the best support for Java. The tools bundle includes the MRJAppBuilder to convert your Java applications into double-clickable Mac applications. As such, you can take Java class files from another platform, port them to the Mac, then wrap them with MRJAppBuilder to produce applications that look as if they were developed on and for Mac OS X. Apple does, however, suggest that for Mac OS X-targeted applications, you take some time to make the experience more Mac-like. For example, the wording and order of menus is different in native Windows and Mac applications. You should display the menus appropriate to the OS that the Java application will run on.
Java on Mac OS X special features
Apple has taken one of its greatest perceived negatives and turned it into a positive over the last few years. The company has long been criticized for not knowing whether it was a hardware or a software vendor. Today, however, Apple's strategy strives to exploit this end-to-end control. You can see this strategy in action with hardware-accelerated Swing. Apple engineers can exploit their knowledge of the video cards the platform supports. In a demo at the WWDC and repeated at JavaOne, Apple showed a G4 Mac rotating an image while a Pentium IV with four times the clock speed attempted the same task. The G4 effortlessly flipped the image over and over while the Pentium IV struggled to rerender the image and jerk it forward little by little.
IDEs benefit from hardware acceleration
Hardware acceleration represents good news for developers who want to make the Mac their development platform. Many IDEs are large Swing applications that look and feel better with this improved responsiveness.
Currently, hardware acceleration is an available option in the developer's preview available from Apple's Apple Developer Connection (ADC). The ADC has made the developer's preview available to both its paying and free members, but you'll have to join first. For now, you'll find hardware acceleration turned off by default, but the Readme includes directions for setting the flag before running your Java application.
Indeed, Borland's JBuilder 5 beta advises you to run this developer release of Java and turn hardware acceleration on to take advantage of its IDE. Borland will finalize JBuilder 5 on the Mac once developers have access to the final version of Java 1.3.1. The JBuilder 5 demo also showcases how well a large, full-featured Java application can run.
Seamless to the user
Moneydance personal finance software serves as an example of a consumer application written in Java on Mac OS X. The application installs easily and runs like any other Mac OS X application. Consumers need not know the application was developed in Java. Sean Riley, CTO of Appgen Personal Software, began developing Moneydance on Linux. After looking to deploy on Mac OS X, he was drawn to the platform and now does all of his Java development on Mac OS X.
Apple Java-enables its own technologies
Apple has also been Java-enabling its own technology. Apple engineers rewrote WebObjects 5 in Java, and they added QuickTime 5 API support to QuickTime for Java. In addition, Apple is wrapping some of Mac OS X's functionality in JavaBeans available to developers. For example, you can provide any Swing text component with the Cocoa spell checking capabilities with just a couple of lines of code. If you develop on an IDE, you can manipulate this bean as you would any other. Indeed, you can view and change its properties to configure it for your application. Apple has also wrapped Carbon's speech recognition and synthesizer capabilities in JavaBeans so you can add them to your applications. You can still write applications that "run anywhere" -- they just run better on a Mac.
Limitations of developing on a Mac
The news isn't all good for Mac Java developers. If you need to access the latest J2SE beta releases, you'll either have to hang on to your Windows box or simply wait. Although Mac users have relatively quick access to final JDK and JVM releases, the Apple Java team just isn't big enough to deliver betas. While the JDK 1.4 beta has been available for a couple of months to Solaris and Windows users, Apple's only 1.4 announcement is that it will be finalized shortly after Sun delivers the official shipping release.
Sun needs to provide more support
Apple engineers commonly cite the cooperation and support they receive from Sun. They speak of the collaboration with the Sun engineers across the street, as well as the Sun engineers on loan to the Apple Java team. With the commitment that Apple has made to Java, Sun owes Apple more. Even though Sun has to create the Windows implementation of Java, it could at least provide more engineers to help Apple in its porting efforts. It's like high school dating. You had no interest in that person who would do anything for you; meanwhile, you hopelessly pursued the popular one who could have cared less about you. It would be nice to see Sun putting more effort into helping with the Java implementation on the Mac.
Developers clamor for more Mac OS X Java support
Further, in public Apple will only commit to supporting the official J2SE stack. Apple developers, however, again and again ask for certain packages. Apple has announced that it will soon support Java Web Start, JSSE (Java Secure Socket Extension), and then look at Java 3D. Apple engineers note that since the other pieces fit well on top of it, they have focused hard on supporting the J2SE core and improving the performance. As for Java 2, Enterprise Edition (J2EE) support, enterprise applications can currently run on Mac OS X; Apple just won't promise you that they will. As the Mac OS X server story evolves, we may hear more about J2EE support.
Interface Builder is Apple's tool for visually providing the Aqua look and feel to Cocoa applications. Java developers consistently request that Apple provide Interface Builder support for building Java apps. At conferences Apple always responds that it has no plans to add such support. Indeed, the company recommends JBuilder 5 as the tool for visually designing Swing components.
Within two months, when Apple ships Mac OS X 10.1 with Java 1.3.1 included, the entire Mac OS X install base will have free access to the most up-to-date version of Java. Moreover, right now you can choose from a variety of Java development tools available on the Mac, with more on the way. With Microsoft pulling Java support from Windows XP, Mac OS X represents today's strongest platform for client-side Java development. Considering all that, current Windows-based Java developers who don't require Java beta releases should think about moving from Windows to Mac OS X.
Learn more about this topic
- For Daniel Steinberg's report from January's Macworld Expo, see "Macworld ReportBig News for Macintosh Enthusiasts," (JavaWorld, January 2001)
- "MacworldJava 2 for the Mac Almost Ready," (JavaWorld, August 2000), Daniel Steinberg's Java report from the Summer 2000 Macworld Expo, can be found by going to
- "Microsoft Throws Java Out of Windows XP," Kuriko Miyake and Stephen Lawson (JavaWorld, July 2001)
- For all Macintosh-related Java articles on JavaWorld, go to the Mac-specific Java section of our Topical Index
- The Macworld Expo Website can be found at
- For more on Apple's Java efforts, see the company's Java developers' page at
- JBuilder is available from Borland at
- Sign up for the JavaWorld This Week free weekly email newsletter to learn what's new at JavaWorld: http://www.idg.net/jw-subscribe
- You'll find a wealth of IT-related articles from our sister publications at IDG.net