Java on the Palm
Contents
Overview
OK, so you want to run Java on your Palm, but how do you do it? Or you
want to go even one step further and write your own programs. Well,
lets just have a short look on the general structure of things before
going into the details of how to do these things.
Application Level |
this is the application you did write |
it runs on your Palm (or on the desktop in an emulator of your
choice) |
Profile Level |
this is the profile you do base your application on |
this is currently still optional, later you will need to have
this installed on your Palm and available on your desktop
for your application development |
JVM Level |
this is the Java Virtual Machine you actually run on |
this is currently the J2ME/CLDC. you need to have
this installed on your Palm and as well available on your
desktop for your application development |
Running Java programs on the Palm
- Get the required software.
You need a JVM for the Palm to run your programs on. You can get the
source code from SUN for their J2ME and their Palm package and compile
one yourself, or get a precompiled one. I suggest get the
Color KVM
which includes kAWT support (a AWT compatible GUI packages).
- Installing the software.
All you have to do here is to hotsync the JVM and the java programs
(in form of PRC files) onto your Palm...
Writing your own programs
This is a bit more challenging. Before starting this, make sure you have done
the above and can run Java programs on your Palm! Further I do assume you know
how to write and execute a Java program (application) on a PC using the JDK.
- Get the required software.
- Get the
J2SE
from Sun (or whatever you normally use to develop Java applications).
- Get the
J2ME and
the Palm package.
- Get the
kAWT if you
want a AWT compatible GUI.
- If you work under Windows98 and if you want to use my
Makefiles get the
cygwin tools. They do provide a wide range of typical
UNIX tools! If you are a "real" UNIX person you might want to
get a
emacs for windows as well...
- Installing the software.
- Install the J2SE.
- Install the J2ME and the Palm package on top of it!
- Install the kAWT package.
- Now we only need to fix our CLASSPATH. We want to use the tools
from the J2SE with the classes from the J2ME and the kAWT package.
Best is to simply have a look at one of my
makefiles.
- Writing your own program.
Below are the steps you have to do. If you do not know how to do any of
these then have a look at one of my makefiles.
- Write your own program or use the sample of the kAWT package
to start with.
- Compile your program and preverify it!
- Transform your program to a Palm PRC.
- Transfer your program to your Palm.
Limitations
Unfortunately there are some limitations to what can be done in Java
and run on both (Palm and PC) systems. Here is a list of the things I
have noticed so far and some suggestion (if I know any) what to do
about it...
Limitations of programming for the Palm
- The KVM only supports a limited subset of classes you are
used to on the PC! This is less than what one might remember from
the JDK 1.1 days. No swing, no collections, no fancy stuff!
- You are at the bleeding edge of technology...
- And the obvious, the resources of the Palm are quite limited by
themself...
So what can you do about it? Well, wait until this has matured more or help
to develop it further!
Limitations of Palm programs on the PC
- A lot of the Palm features can not be found on the PC. The databases
and the IR-beamer are just two examples. So anything you use which
is not from java.* (especially the things from com.sun.kjava.*) will
not work on the PC! At least for the Database I have a solution, have
a look at PoP.
Speeding up Java on your Palm
- Programming efficiently is always important, but on small devices
such as the Palm it is rather fundamental! There are some sources
for tips (for Java in general, not KVM specific). For example have
a look at
"Optimizing
Java for Speed".
- And there is specially a much cooler way! Tune up your Palm!
You can use something like
Tornado. I got a Palm 3x
and tested Tornado (the 30 day demo version) with the KVM0.2ea. I did
set the KVM and all Java programs (PRC) to run at twice the speed and
it worked perfectly! But do that at your own risk! And no, I
do not work for them or get any money from them...
Any other suggestions? Let me know!
Makefiles
Here is my Makefile I use for Linux/Solaris. I sometimes work under Windows as
well. There are some small changes required, as documented in the Makefile
itself.
This Makefile offers the following (main) entries:
- make, make all to compile your application
- make pilot to preverify and build the PRC
- make install to install the PRC on the Palm (Linux only)
- make clean to cleanup the classes
- make run to run the program on the desktop