Mobile Chai

Although the product name sounds like a Starbuck’s-induced nightmare, Hewlett-Packard’s Mobile Chai development suite is actually pretty dreamy. The Mobile ChaiVM is a super-optimized Java Virtual Machine with implementations for Dragonball (PalmOS devices), Windows32, Linux, SH3 (some PocketPC devices), and StrongArm (other PocketPC devices). Although IBM, Kada, Tao Group, and other vendors have created implementations of Personal Java for PocketPCs, this is the first time that Windows CE devices have been able to run MIDP. As for other devices, HP’s implementation is one of the fastest — and smallest — available.

Mobile Chai is going to be integrated into the ROM of the upcoming HP Jornada 928 — a GSM/GPRS phone and PDA in one — as well as on HP’s low-end printers such as the InkJet. And a version of the VM can easily be installed on most other devices.

At the core of HP’s micro Java work is the nifty ChaiFreezeDry technology (told you the names were scary). ChaiFreezeDry compresses Java classes by as much as 50%. Boris Teksler, the Director of Marketing and Solutions at HP, gave me the lowdown. “Space is an extremely valuable resource on a device,” Teksler said, “and being able to save on that saves a substantial amount of money.” Saving space also makes programs download more quickly, run more efficiently, and start up faster.

Many JVMs use compression technology to save space. But decompression takes valuable time and eats up storage memory — while a class is being decompressed two copies of that class must be in memory at once! ChaiFreezeDry focuses, instead, on concentration and pruning. Concentration involves reworking classes so that commonly repeated functions are broken out, creating as little redundancy as possible. Pruning is even more severe — getting rid of extraneous classes and methods in the Java library that aren’t being used — allowing some classes to be reduced by 90%. “Our VM itself is concentrated and pruned,” Teksler said, “which is why we have the leading size implementation.”

To ChaiFreezeDry a class, a developer needs to run it through a special tool called “fdcon”. This will then create a proprietary, pre-linked FD file. The VM loads and deals with the FD file at runtime. The freeze-drying can also be automated on a server so that devices with Mobile Chai can download FD files on-the-fly.

Indeed, the claim is that Mobile Chai runs as fast as the Sun and IBM VM implementations, but takes up much less storage memory. On my iPaq, the Mobile Chai beta uses 422K. I tried out a copy of the SpruceChess MIDlet (see Figure 1). Everything runs exceptionally smoothly — which you would expect, considering how much more processing power an iPaq has versus most MIDP mobile phones. Additionally, the default interface widgets and bottom pull-up menus mesh well with native PocketPC applications.

Figure 1: Running SpruceChess on Mobile Chai.

It should be noted that Mobile ChaiVM imposes pretty strict limits on the size of Java applications. The total number of classes, fields, and methods may each not exceed 64K; the total number of unique class names, method names, and field names may each not exceed 64K; and the bytecodes in a method may not exceed 64K. These restrictions should not be a problem, however, because most micro Java implementations have similar limitations.

The question, of course, is why would anyone want to write stilted MIDP programs on a typical PocketPC device, which supports much more advanced graphics and animation, rich audio, and slick interactivity?

If you’re looking for a way to write high-end mobile games or productivity apps, MIDP and Mobile Chai aren’t the way to go. It makes much more sense to use Visual Basic or C# with Microsoft’s PocketPC development environment. However, if you’re a big company trying to build handheld inventory software for your sales team, doing it in Java makes perfect sense. It means you only need only to create one client application, which then can be tailored for various platforms. With products like Mobile Chai, every member of your team can run the app whether they are using a MIDP-compliant phone such as Motorola’s i85s, a MIDP-compliant RIM Blackberry, a Palm, or an iPaq.

“Handheld devices are becoming managed devices,” Teksler said. “There’s a strong need for enterprises to retrofit CE devices to run their Java software, whether or not they ship with this capability.”

Following a release planned for May 10th, developers can purchase and download the HP development kit from Handago. It will then be possible to write MIDP Java applications, as well as freeze-dry them. The kit also comes with an emulator (see Figure 2), so that programs can be debugged right on the PC. Developers then can distribute the Mobile Chai runtime by purchasing licenses in packs of 50, 100, 500, and so forth. You can get more information about Chai and associated tools from HP’s developer site.


Figure 3: Running the Mobile Chai emulator on a desktop PC.

While we’re on the subject, it’s also worth noting that HP is planning to come out with a version of Mobile Chai for BREW — the embedded language that runs on phones using the Qualcomm chipset. BREW’s development tools have traditionally been unwieldy and wildly expensive. HP’s new kit will allow developers to write to the BREW APIs using Java.

David Fox is the author of numerous books and articles about cyberculture and technology.

Get the Free Newsletter!
Subscribe to Developer Insider for top news, trends & analysis
This email address is invalid.
Get the Free Newsletter!
Subscribe to Developer Insider for top news, trends & analysis
This email address is invalid.

Latest Posts

Related Stories