Eric Liu: |
Developing for Palm using Java |
I just started investigating how to develop applications for the Palm using Java, and have already encountered some gotcha's. I'm doing this on a Win32 machine. First of all, there's a nice article on how to get started on java.sun.com. Unfortunately, the directions need some adjustment to work with the current versions of the downloads.
First, the files you need to download are now named the following (these are version 1.0.2 as opposed to verion 1.0 as described in the article):
Next, the section The J2ME CLDC Development Environment describes the tool that will actually turn your class files into a .prc file ready to hotsync to the PDA. This tool is written in Java and needs to be compiled. The base directory of this tool is ${J2ME_HOME}/tools/palm. At the end of this process, under that directory, you should have:
Note that this tool has nothing to do with your development. It is a deployment tool.
The compilation and deployment instructions need to be updated since the classpath required has changed. After you type in the HelloPalm.java program, below are the corrected commands. Please note that KVM_CLASSPATH is just a convenient constant I use (it's not syntactically correct).
let KVM_CLASSPATH = ${J2ME_HOME}/bin/kjava/api/classes;${J2ME_HOME}/bin/common/api/classes
javac -bootclasspath ${KVM_CLASSPATH} HelloPalm.java
${J2ME_HOME}/bin/win32/preverify.exe -classpath .;${KVM_CLASSPATH}
HelloPalm
cd output
java -classpath ${J2ME_HOME}/tools/palm/classes
palm.database.MakePalmApp -bootclasspath ${KVM_CLASSPATH}
HelloPalm
If you want to run your application using the KVM/Palm emulator, the correct command is (make sure you're in the output directory):
${J2ME_HOME}/bin/kjava/win32/kvmkjava.exe -classpath .;${KVM_CLASSPATH}
HelloPalm
This is as far as I got tonight. I found that it's very educational to setup an Ant build file to automate the compilation, deployment, and execution process. Also, I will check out the J2ME Archive later, which seems to hold a lot of relevant information.
Eric Liu
Last modified: August 21, 2001