Since the Java language and platform are targeted at a wide variety of platforms, one size of Java application doesn't fit all targets. That's why Sun provides three different versions of the Java 2 platform: a standard edition for typical use, an enterprise edition for server use, and a micro edition for consumer communications devices.
Borland JBuilder 4 is among the first IDEs capable of automatically helping you build applications that support these different Java platforms. In particular, the JBuilder Handheld Express targets Java applications for Palm devices running the K virtual machine (KVM). The KVM is Sun's VM for small, resource-limited non-PC computing devices, included as a part of J2ME. It's designed for devices with small, low-power processors, and with as little as 160KB of total memory available, and can be downloaded into any Palm with enough memory.
The Handheld Express is intended to develop applications specifically for personal computing and communications devices that may not have a persistent Internet connection. These smaller handheld devices are addressed by Sun in the J2ME Connected Limited Device Configuration. These types of devices operate off of battery power, have significant memory constraints and limited processing power, with low bandwidth, high-latency network connections.
In addition to this specific target, JBuilder's Handheld Express provides features that dynamically adapt to any J2ME profile, including the Mobile Information Device Profiles (MIDP) currently being developed through the Java Community Process. If you're writing Java applications for non-PC computing devices, the Handheld Express is a good place to start.
One reason why Borland targets the Palm is the availability of a good Palm emulator on which to test your applications. This is available through the developer area of the Palm Computing Web site. You install the Palm emulator on a Windows PC, Mac, or Unix machine, download ROM information for a specific Palm device (either from your own Palm or available in the developer area of the Palm Web site), and you're ready to test out your Java application right on your development system.
The Handheld Express is a Zip file that can be downloaded from the Borland Web site. It's installed by placing a jar file into the lib directory of JBuilder. The next time you launch JBuilder, the Handheld Express will automatically load.
Handheld Express adds two new items to the Object Gallery used by JBuilder to create new project types. These items are found on the Micro tab, in the Object Gallery, which is created when you install the jar file. The first item is for creating a new Handheld Express Project. You must use this type of project file for all applications that you create using the SDK for the Palm.
JBuilder Handheld Express Spotlet Source View
The second is for creating a Palm spotlet file. The spotlet is a
function of the J2ME environment; it's the class that provides
callbacks for event handling. If you want to do any event handling,
you use the spotlet project, extend the
Spotlet class and
rely on the Palm to call
penDown() in response to the
Once you've selected the J2ME project, you go about developing a Java application in the usual manner. You are simply constrained from using any of the classes that aren't available for the J2ME. For efficiency's sake, I started with one of the examples available, a tip calculator, and expanded it to support an unlimited number of tip amounts.
Once I was done, I launched the Palm emulator, choosing a Palm V,
my most recent Palm (the emulator lets you choose from any Palm ever
made, so I could even have emulated my aged but still functional Palm
Pilot). I loaded the KVM onto the Palm emulator, converted the files
to Palm format, then selected and loaded the calculator file, and
launched it. After a few iterations with the JBuilder debugger, the
calculator seemed to work properly. JBuilder supports converting the
files into the Palm's
.prc format directly from within
Then it was time for the acid test. I downloaded both files to my Palm V and was able to use the tip calculator live almost immediately. My total learning, development, and testing time for this small application was less than half a day.
One of the biggest problems in writing Java applications for non-PC devices using the J2ME is that you can't use all of the Java classes you're used to, for both JVM support and performance reasons. Knowing what classes you can use requires a careful study of the J2ME class library, the experience to know what can be done on the platform, and the most efficient way to do it.
The JBuilder Handheld Express does that work for you. And the addition of the Palm emulator lets you test and debug before testing on the real thing. Of course there's no requirement that you deploy J2ME applications to the Palm platform. The HHE, in conjunction with the Palm emulator, just makes it easier to do so. And because Java is increasingly popular with handheld and other embedded devices, this won't be the last tool of its kind.
You can download the Handheld Express from the Borland web site, as well as the Foundation edition of JBuilder 4 (which includes the editor, compiler and debugger). This represents a great value in building Java applications for Palm, and a new target market for Java. Developers who are interested in Java for non-PC devices will find a good starting point with JBuilder 4 and the Handheld Express.
Peter Varhol Peter Varhol is a well-respected columnist and product reviewer with JavaPro magazine. He is also a senior developer with Compuware, Inc.
Return to ONJava.com.
Copyright © 2009 O'Reilly Media, Inc.