The Mobile Developer
by Eric Giguère, January 15, 2000
Waba: Run Java programs on your handheld
Running Java programs on your handheld computer,
whether it be running Palm OS or Windows CE,
may seem like a bit of a dream to you, even
with Sun Microsystem's announcement last summer of the
Java 2 Micro Edition (J2ME). For many of us,
the proof is in the pudding, and J2ME is still
an unreleased and evolving product, which I'll
discuss in a later column. If you want to run
Java programs now, however, there is
an alternative called Waba.
Waba is an open source product developed
by Wabasoft,
a small company whose tagline is
"we have big ideas for small devices". Waba
is not a licensed Java runtime environment
officially sanctioned by Sun Microsystems.
It's a clean-room implementation of a
stripped-down Java interpreter and runtime library.
Wabasoft takes great pains to point out that
Waba is not Java.
If Waba is not Java, then how can you use it
to run Java programs? As it turns out,
the Waba interpreter accepts a subset of the
bytecodes accepted by a Java interpreter
and can read the class files produced by
a Java compiler. As long as you avoid
operations that produce unsupported bytecodes
(anything involving long or double types,
threads, threads or exceptions) you can
use your favorite Java development tool
to write a program that the Waba VM can
run.
But what about the runtime library? Just
as important as the interpreter are all those
classes for doing basic things like string
manipulation and displaying a user interface.
Licensing concerns aside, porting the standard
Java runtime classes to a handheld device
could easily exceed the amount of memory
available on those devices. So how does Waba
do it?
The answer is simple: Waba provides its own
runtime library, but with a twist. If you
know anything about compiling Java, you know
that Java bytecodes will include hard-coded
references to a few classes like java.lang.Object,
java.lang.String and java.lang.StringBuffer.
The Waba VM simply replaces these with references
to equivalent classes (waba.lang.Object, etc.)
in its own runtime library. Except for these
"parallel" classes, the rest of the Waba
runtime library is unique to Waba and includes
basic functionality for building
graphical user interfaces and reading/writing
data. However, included in the Waba SDK is
a second runtime library that implements the
classes in the Waba library in terms of their
equivalents in the core Java library. This
lets you run a Waba program on a machine with
a standard Java runtime environment, which
is particularly useful when you're developing
and debugging a Waba application. Waba thus
lets you write programs that can run
unchanged in handheld devices or in
web browsers, which is a neat trick.
The Waba VM is free and runs on Palm OS
or Windows CE. As I write this, Waba is about to be
released, having been
in beta for a number of months now
and garnered quite a bit of interest
from Java enthusiasts. It's being released
with an open source license, which could
lead to it being ported to other devices.
If you're at all interested in running
Java programs on small devices you should
definitely check it out.
Eric Giguère is the author of
Palm Database Programming: The Complete Developer's Guide
and an upcoming book on the Java 2 Micro Edition. He works
as a developer in Sybase's Mobile & Embedded Computing division.
Visit his website at www.ericgiguere.com
or send him mail at ericgiguere@ericgiguere.com.