Macworld: Java is alive and well on the Mac

Mac OS X gives Java developers unprecedented opportunities

January 18, 2002 — Steve Jobs’ Macworld keynotes always include Java news: you just have to listen carefully because it isn’t explicitly stated. Indeed, Jobs’ keynote at the Macworld Conference and Expo held in San Francisco featured two announcements important to Mac-based Java developers: Mac OS X will become the default OS a bit earlier than expected, and the newly revamped iMac will include an upgrade to the speedier G4 processor.

Beyond news from the keynote, JavaWorld‘s “State of Java on the Mac” session featured four product demonstrations of Java applications running on Mac OS X, as well as a Q&A session with Apple’s Java product manager and its Java technology evangelist. As expected, the question of JDK 1.4 support in Mac OS X arose; perhaps to the audience’s surprise, it was partially answered.

The keynote

The boldest announcement Jobs made in his keynote is that Mac OS X will be the default OS in all new Macs by the end of this month. Mac OS X, built on top of Unix, contains the Java 1.3.1 runtime, as well as command line tools such as javac, java, jar, rmi, and rmid that Java developers require. In addition, Apple will continue to make its developer tools — Apple’s IDE Project Builder with Java development support, Cocoa, and Applescript — available for free with Mac OS X.

Although Mac users could choose to boot into Classic Mac 9.2, their first experience on the new Macs will be Mac OS X. While Microsoft continues to cloud the Java issue on Windows, Apple strives to install and run Java 2 on its entire Macintosh fleet. Moreover, because each Mac machine runs the same Apple JVM, developers will find it easier to target the Mac platform.

In addition to less complication for Java applications, Java 2 applets run well in browsers on Mac OS X machines because the browsers run Apple’s JVM. The install also includes Java Web Start, so developers can take advantage of that technology as well. So far, only Microsoft’s Internet Explorer for the Macintosh correctly runs applets and interacts with Java Web Start. However, according to Omni Group engineers, the company shouldn’t have difficulty Java Web Start-enabling its browser.

Much of the keynote news focused on the design of the new iMac line. From that news, Java developers should note that Apple will upgrade the entire iMac line to the G4 processor — a move that will benefit both those developing on an iMac and those developing applications for the Mac platform. For example, Swing applications will respond better on iMacs running Mac OS X once the kinks are worked out of hardware-accelerated Swing (and it becomes the default in the Mac OS X Java distribution). You can already see these advantages in Borland’s JBuilder 6.0, which runs smoothly under Mac OS X on a G4.

The demos

JavaWorld‘s “State of Java on the Mac” session showcased Java applications working on Mac OS X. These large applications would never have been available on the Mac if it weren’t for Apple’s commitment to the technology.

Indeed, it becomes more and more difficult to tell a Java-based Mac OS X application from a native application. Java developers can truly target multiple platforms with a single application.

eVision’s Visual Search technology

Kasu Sista, eVision’s vice president of technology, demonstrated the company’s sophisticated, Java-based Visual Search technology, a visual search engine. Sista mentioned that eVision ported the application to Mac OS X in just two days. He reported that the application experienced an initial 25 percent performance hit by choosing Java, but JVM improvements have reduced the gap. As the only Java-based visual search engine, he said, eVision can make its product available on any platform with a JRE.

eVision’s Visual Search technology allows users to search a database based on visual cues, a task that requires significant computational prowess. Currently, most Internet search is text based, making the search dependent on meta tags and keywords. However, problems arise with text-based searching because of incorrect meta tags, inconsistent keywords, or language differences between the user and the database, as examples. The eVision application, in contrast, segments images into object regions, then generates the meta tags used in the search. eVision’s Visual Search online demo allows you to search images by color, texture, shape, and object. Imagine a future in which you can search on other senses such as taste, smell, or emotion.

During his demonstration, Sista sketched a primitive version of the Apple Computer logo, then searched just based on his drawing. The database returned all of the images of the Apple logo, as well as a few duck images (which did look similar to the logo). The Apple logo search represents an effective search through a large amount of data. Moving on, Sista executed a mug shot search through a database of faces. He clicked on a bald, clean-shaven man with glasses. The application retrieved all faces in the database with similar characteristics. Then, using the original man, he sketched a rough, rather funny-looking beard on the face. The application quickly returned a subset of the original group, including those who also sported a beard. The ease with which he performed the refined search demonstrated eVision’s potential.

Borland’s JBuilder6

Blake Stone, Borland’s chief scientist, gives great JBuilder demos. JBuilder 6 is a large, 100-percent Java IDE. During the demo, Stone reported that Borland ported JBuilder to Mac OS X in a matter of hours, with an extra couple of days of platform debugging. He said that the remaining porting time was spent “working with Apple to make sure that their VM is a solid offering.” Borland wants Apple’s JVM up to snuff because JBuilder 6 is a single code base for all platforms.

Java development on the Mac is much easier using JBuilder 6. As with earlier editions, developers can choose to use visual designers or to work directly with code, depending on what is more appropriate. The text editor immediately displays your code’s structure as you add, modify, or remove fields and methods. Stone demonstrated JBuilder 6’s new UML tool that visually displays your code’s organization. He demonstrated how the UML tool can rename (or even move) classes, methods, or fields. Further, JBuilder 6’s built-in refactoring features can rename not just a method, but also all of the names used to call that method. From the UML diagram you can also locate methods and fields, go to where they are declared, and view their Javadocs.

An audience member asked Stone about multifile search and replace. He replied that refactoring has been a higher priority, but that it has been on their list of things to do for many versions and would move higher up the list if enough users requested it.

Borland has also improved Javadoc support in JBuilder 6. The IDE automatically adds the Javadoc comment template if you type /** before a method. It also warns you if code changes desynchronize the code and matching Javadoc comments.

JBuilder 6 also features support for CVS, the developer tool included with Mac OS X. A commit browser allows you to easily interact with CVS. As an additional feature, by clicking on JBuilder 6’s history tab for any class, you can see the class’s history and easily perform diffs to see what has changed. JBuilder 6 also includes several mechanisms for running unit tests. You can either choose JUnit TestRunner from the junit.swingui or junit.textui packages, or use Borland’s own test runner.

Apple’s QuickTime for Java

After surveying the audience, Michael Hopkins, an Apple QuickTime for Java (QTJ) engineer, realized he had to provide more of an introduction to QTJ than he had planned. QTJ comes pre-installed in Mac OS X, so developers can write to the API knowing that Mac OS X clients can run QTJ applications without any additional software.

Hopkins’ most impressive demonstration was the new performance realized by the addition of a lightweight canvas object. Apple has hardware acceleration available for Swing applications. The QTJ engineers have added the new JQTCanvas lightweight component that allows QuickTime media to take advantage of such acceleration. Hopkins showed a demo of a movie, along with its reflected image below squashed to a third of its height, rendered more faintly and upside down. He reported performance as good (and sometimes better) as native.

Other recent enhancements to QTJ include audio, timebase callbacks, and effects. Audio improvements include asynchronous recording and playback, level metering, and support for equalizers. He also mentioned timebase callbacks, which allow you to jump to specified moments in a movie timeline. The QTJ team improved these timebase callbacks’ performance by employing high-priority native threads. As for effects, you can now transition between movies in the same way that you’ve been able to transition between static images. You can easily create a dialog box to allow users to pass in effect parameters and view a preview picture in the dialog. Hopkins noted that future versions of QuickTime for Java will support forthcoming features such as MPEG-4.

ThinkFree’s ThinkFree Office

ThinkFree president and cofounder T.J. Kang showed off the pure-Java ThinkFree Office, and discussed issues of running it on a Mac. Kang said that he was pleasantly surprised at how easy it was to move ThinkFree Office to the Mac. But, he did report that ThinkFree is having difficulty getting good performance on Mac OS X. He said Apple suggested that ThinkFree turn off hardware acceleration. In addition to improving the look and feel of the product, Kang said ThinkFree also plans to move to XML-based file formats for improved portability. He also noted that most of his company’s revenue comes from Mac users in Japan.

The JDK 1.4 debate

Developers continue to argue over Java 1.4 on Mac OS X. On the one hand, Apple delivers a solid implementation of the latest released version of Java to all Mac OS X users. Compared to the Java support on the Windows platform, Apple provides solid “out-of-the-box” support for Java. On the other hand, Java developers don’t have access to beta releases, while Windows users have had access to various betas of Java 1.4 for nine months now. Mac-centric developers won’t have access to Java 1.4 until Apple provides it. Allen Denison, Apple’s Java product manager, expects that Java 1.4 on Mac OS X might be available by the Worldwide Developers Conference in early May. Denison said that Apple will also provide an easy way for developers to switch JVMs so that they can run and test in 1.4 or 1.3.1, at least until 1.4 is released to the general public.

Blake Stone added that Borland strongly urges Apple to quickly release 1.4. Denison responded that many developers feel as strongly that Apple should stay with 1.3.1. Most developers seem to just want to know what and when. Java developers have tried to make the point that they should be considered in this venture. In order to build software, they need to know when Apple will support the platform on which the software runs. Other developers argue that since Java 1.4 isn’t final, there’s no reason for Apple to try to engineer a moving target. In any case, Denison assured the audience that much of the work for Java 1.4 has been done, and, once Sun Microsystems goes final with it, Apple can better plan. He explained that Java 1.3 was Apple’s first Java release on Mac OS X , so Apple has focused its resources on making the 1.3 implementation solid.

Although Apple has made significant commitments to Java, the company has limited resources. Apple, when it comes to Java, also suffers from lack of attention. Sun continues to put resources into bringing Java to the Windows platform. Apple includes a good implementation of Java in their OS and could use more help from Sun in getting it out the door more quickly. Sun has actually moved in the opposite direction by discontinuing some of the support it had given to Apple in the past. For example, Sun discontinued its Java engineers who physically worked at Apple late last year. As Sun builds alliances and decides what to support, it seems that Mac OS X would be a natural choice. For Apple’s part, Denison feels that Apple’s relationship with Sun is getting stronger.

An Apple a day

Many of those coming to Mac OS X are hardcore Unix- and Linux-based Java developers. Apple offers solid support for their activities with the traditional Unix tools on a secure, attractive, stable environment with full Java support. While Classic users have been a little more reluctant to come to Mac OS X, Apple is pressing the issue by making Mac OS X the default OS, thus bringing more users to the platform. For Java developers, every one of these new users can easily run Java applications. Meanwhile, it shouldn’t be long before the professional hardware gets revised as well. The new iMacs have G4 chips and run almost as fast as the Pro line. Look for speed jumps in the G4 towers and iBooks before long.

Daniel Steinberg is the
director of Java offerings at Dim Sum Thinking, Inc. He learned to
program in C and C++ on a Macintosh to help his research on elastic
curves in hyperbolic space before moving to Java. Daniel teaches
courses in Java and object-oriented architecture and design, and
has become quite fond of many of the practices of XP. He cowrote
the Java2 Bible from Hungry Minds. He thinks that the
first words spoken by his daughter Maggie Rose were “my Mac” — his
wife thinks Maggie was saying “Mama.” Maggie knows that she was
asking clearly for an “iMac” and keeps hinting that an iBook would
be nice for her fifth birthday. Her younger sister Elena is less
subtle and has announced that now that she’s two she “needs” a
Titanium PowerBook.

Source: www.infoworld.com