Think small: Java on Compaq's iPAQ

Develop micro-Java solutions with Jeode and the SavaJe XE OS

During JavaOne 2001, I looked at several alternatives for working with Java technologies on Compaq's iPAQ. (See "Putting Java on the Information Appliance" (JavaWorld, June 2001).) Since then, I've looked into the software-based offerings -- Insignia's Jeode and SavaJe Technologies's SavaJe XE OS -- more closely. While we're still waiting on the hardware-based Java solution, Jazelle from ARM, these software-based alternatives are more of a reality today. In this article, I will review these technologies and show how you can use them to develop mobile applications.

The hardware

First, some background on the iPAQ -- a Pocket PC loaded with Windows CE. In the near future, that will change to Microsoft's Pocket PC 2002 OS, but that won't affect the information here. With its flashable ROM, you can easily upgrade the operating system via software instead of swapping hardware. You won't have to trade in any hardware chips; you just send over the new operating system via its network connection.

Figure 1. A Compaq iPAQ

The device runs on Intel's 32-bit 206 MHz StrongARM processor and is the size of your typical PDA device (5.11" by 3.28" by 0.62"), weighing in just under seven ounces. The gray-scale model, while nice, isn't worth the gray scales. For a little extra money, you're better off with a model that supports 4,096 colors (12-bit). Both the black-and-white and color models start at 16 MBs of RAM and offer 240 by 320-pixel resolution with a 2.26" wide by 3.02" tall viewable area. The color TFT screen is amazingly bright, even providing acceptable viewing support off-center and outdoors.

Beyond the basic PDA applications, like a calendar and scheduler, many people are drawn to the iPAQ for its ability to share files with the desktop. You get applications like Pocket Excel and Pocket Word that let you work with Microsoft Office files and even Microsoft Money for financial planning. It is nice to be able to log your financial transactions on the handheld, then sync up with the desktop version. You can even play MP3 files on the iPAQ, though from a cost perspective, using it solely as an MP3 player is unwise. At best, the sound comes across tinny (too much treble, no bass) when playing music, though it is clearer over a headset. There's even solitaire and a golf game on the CD accompanying the system for those looking to fill some meeting time.

The device supports an expansion sleeve for you to add a PCMCIA (Personal Computer Memory Card International Association) card, if you don't mind carrying another six ounces. You can use this for wireless networking or additional memory. Unfortunately, the iPAQ didn't support my wireless card so wireless networking wasn't an option for me. Before buying your own wireless network setup, be sure it provides Windows CE support for the networking card if you plan to put an iPAQ on your network. (Lucent is a good bet here.) I was left wire-connected to my desktop's serial port. The iPAQ also has USB (universal serial bus) support and infrared. Cradles are also available.

iPAQ's future

Hewlett-Packard (HP)'s recent announcement that it will purchase Compaq throws an interesting wrench into the mix. HP has its own Pocket PC device called Jornada. We'll have to see what HP does with both devices, assuming the Compaq sale finalizes. See "Pocket PCs after the Merger" for one analyst's opinion of the devices' post-merger futures.

Though I wasn't able to access a Jornada for this article, Jim Feck, in his review "Compaq iPAQ vs. HP Jornada," found the iPAQ fared better than Jornada 540. In a head-to-head comparison, Feck found the iPAQ was faster with a better screen, but had limited availability and no built-in CompactFlash slot. With Jornada 540, Feck found a solid device, but thought it had major weaknesses in critical features like its screen and performance.

With the exception of iPAQ's latest model H3800, available in November 2001, the one significant omission from the iPAQ 3650 I used for this review is a Java runtime. That's where Jeode and SavaJe XE OS come into play. The H3800 is expected to ship with Jeode. I expect SavaJe will find an OEM (original equipment manufacturer) to ship iPAQs with its operating system as well.

Jeode for Windows CE

When you need Java support for an information appliance like the iPAQ, the Jeode platform is the first place you should look. Insignia offers a PersonalJava or EmbeddedJava runtime for many different platforms. (See "J2SE, J2ME, and PersonalJava -- What's the Difference?" sidebar at the end of this article.) Its Website lists Compaq, Fujitsu PC, Intel, and Motorola, among many others, as its customers, showing the wide range of devices supported. The actual processors supported are ARM, MIPS, x86, StrongARM, SuperH-3, SuperH-4, and PowerPC.

Jeode's strongest selling point is that it's a direct add-on to any hardware. The way you use the device doesn't change; it's just easier to add more capabilities since you can write them in Java. In the case of Jeode on the iPAQ, those capabilities include any PersonalJava-compatible applications. Users continue to use their PIM (personal information manager), have access to Microsoft Office files, and don't need to discard any custom applications created for the device. From the outside, the device looks and acts the same.

To try Jeode on the iPAQ (or any other device), developers can get a free 90-day evaluation copy of the runtime by visiting the Insignia Website. For your users or for yourself, the single-user cost beyond the trial is only 0, decreasing with volume purchases. You get a 13 MB installable executable that includes a JVM for the iPAQ and some tools for the desktop to help you create iPAQ-deployable Java programs. A word of caution though: If you are not specifically installing the toolset on a Windows NT 4 machine, for example on a Windows 2000 box, the installation program gives a warning. The installation still ran fine on a Windows 2000 box, but the warning might concern some people. Using the toolset in Windows 2000 though is "unsupported" from a corporate perspective. Once installed, you use ActiveSync to put the necessary files on the iPAQ. After transferring, click on the synced file to install Jeode. The whole process takes about 15 minutes, most of that time is spent transferring the 4 MB file. At this point, you can play Asteroids or view one of three AWT (Abstract Windowing Toolkit) sample programs.

Interested in putting your own program on the device? Step one is easy: Just compile with the JDK to create the application class files. Step two involves running a tool called JeodeFilter, which generates a list of required classes, both application and system. Then, the JeodeCompact program takes this list of required classes, allows you to add in any resource files, and generates a jar file for the application. JeodeDeploy then takes the jar file and generates a target-specific (like the iPAQ) set of C source files. The next step involves compiling before finally deploying. Assuming you have a C compiler, it isn't as bad as it sounds. Just a few extra steps are involved in order to get your program onto the device. You will need to use either the make or Ant build tool. A JeodeConfigurator tool lets you test your applications on the desktop by tuning properties like memory size to emulate the target device more closely.

Here's a simple program you can experiment with:

public class HelloJeode {
  public static void main(String args[]) {
    System.out.println("Hello, Jeode");

That's all there is to Jeode, a nice add-on that lets you continue using the iPAQ as a Windows CE device. Jeode should also have a J2ME (Java 2 Platform, Micro Edition) option before the year's end.

Jeode for Linux

In addition to running under Windows CE, Jeode also runs under Linux on the iPAQ. Basically, you replace the Windows CE operating system with Linux. You can download the operating system from the PocketLinux Website among other places. Once you install the operating system, installing Jeode on Linux is similar to installing it on Windows CE; you just obtain a different package from Insignia. Programming on the Linux-run iPAQ is also similar once you have the runtime on the device. The sole difference is the JeodeDeploy step, which generates a different set of C source files and links into a different Embedded Virtual Machine (EVM) image.

From a user's perspective, the biggest difference between using Linux over Windows CE is that you must replace all the applications on the device. You get to choose from all those that run on top of Linux or can choose from any PersonalJava-run application.

SavaJe XE OS

SavaJe Technologies takes a completely different approach to putting Java on the iPAQ. Scheduled for an October 2001 release, the SavaJe XE OS completely replaces Windows CE (or even Pocket PC 2002 OS) on the iPAQ. However, it requires 32 MB RAM and a color system. SavaJe offers a free beta and a projected 00 single-user price tag. The OS comes from a team originally from Lucent Technologies. Remember Inferno? Core members of the Inferno OS team realized they were fighting a losing battle and turned their attention to Java. As a result, they formed SavaJe (pronounced "savage").

By replacing the operating system, SavaJe supplies a whole new set of Java-based tools, providing a best-of-breed look at the latest in pure Java offerings. In addition, while not offered with the OS, SavaJe points you to ThinkFree if you need Microsoft Office file compatibility. ThinkFree is a Java-based suite of tools similar in functionality to Microsoft Word, Excel, and PowerPoint. At just 0, not only is ThinkFree cheaper than Microsoft Office (for the desktop), but it is Java-based so it runs everywhere, including on the iPAQ. As far as other tools, you get Espial Escape for your browser and a homegrown tool for the PIM. There is also an MP3 player and Notepad-like editor; the only tool missing is a calculator.

For Windows users, installing SavaJe involves downloading a 12 MB zip file, unpacking the zipped file, and running a setup program that first copies a bootloader to the iPAQ before copying the rest. You can back up Windows CE, in the event you choose to restore it later. The whole process takes about 30 minutes, less if you don't backup CE. For those interested in pain, complete instructions for manually copying the bootloader and operating system are available. While you can do it with the help of a terminal program, the installer is much easier, although Windows-specific. Desktop Linux users will have to go through the lengthier process of copying the individual pieces.

Figure 2. The basic SavaJe XE OS desktop

Once loaded, you have what looks like a multiuser, Unix-based OS, but rather is an OS actually running Java. SavaJe's selling point is that since everything is Java-based, it could remove several layers between the Java APIs and the OS layer to wring out performance bottlenecks, improving speed considerably. At this, SavaJe seems to have succeeded quite well.

Developing for the newly installed SavaJe OS is easier than for Jeode. You just use the JDK or your favorite Java development tools. Once the class files are generated, no extra steps are involved. Just copy the file over the network or onto a CompactFlash card from your PC and you're set to go. There's even an option to have SavaJe load the classes from the Net, so you don't have to copy them. It is that simple.

In addition to the core Java 2 Platform, Standard Edition (J2SE) APIs available, you get the Java Phone API to handle power management from your programs, and the Java Comm API to communicate over the port connectors. And, since the OS is J2SE-based, you can add extension APIs for such things as SSL (Secure Socket Layer) support. Also interesting, the Windows CE Record button now rotates your screen 90 degrees, a nice feature for such a narrow screen. Add on a compact Compaq keyboard, and you have yourself a development machine, since you can even run the compiler on it.

The biggest drawback to developing for the SavaJe XE OS is the lack of emulator. Since you have the full suite of Java 1.3 APIs, you may assume you don't need one. Unfortunately, you can't simulate the limited memory space on the desktop, and the fonts are different, unless you add your own TrueType fonts. Sure, you can limit your screen size to 240 by 320 pixels, but you don't get the feel for the device's scrolling support when the screen is too large. If your application is not built for a small-screen device like the iPAQ, it will still run since it is based on Java 1.3. You just have to learn to scroll to those offscreen pieces. Also, if you run out of memory in an application running on the OS, the application just shuts down. An OutOfMemoryException triggers the OS to unload the application. Since most desktop machines have more memory than the iPAQ, this condition is not readily repeated on the desktop. Perhaps an emulator is in the future, but for now sizing can be hit or miss.

Is performance the issue?

From a performance perspective, the OS-based approach clearly wins. By removing several layers between the Java API and the operating system, the SavaJe environment runs several times faster than the Jeode platform. However, we shouldn't look at this purely from a performance perspective. Insignia and SavaJe take two completely different approaches to attacking the problem of running Java on the iPAQ.

1 2 Page 1