iMode Top : IAppli Notes
The application I am developing is called "PicoBrowser", and is a tiny combined browser and stripped down "servlet engine" which runs as an IAppli, in less than 7500 bytes of code. The PicoBrowser supports a very limited subset of HTML.
The motivation for this is that the 503i phones seem to have no integration between their microbrowser and their Java engine. It is useful in many cases to be able to output HTML from your applet to present small documents or other data to users. Embedded hyperlinks in the document can be followed to retrieve other documents from the web, the JAR file, or as calls to tiny "servlets" in the application itself.
Hopefully, in the future, NTT or Sun will make a standard interface between the CLDC/MIDP spec and a web browser running in the same device. If they did that, then it would be much easier and more efficient to write servlet type applications that use the existing microbrowser, instead of building the while UI by hand each time. Actually, this is a pet peeve of mine, even the desktop browsers have very poor connectivity between the browser and the Java VM. I am a big believer in browser based UI for a lot of applications, especially when they are very responsive, as is the case with a local server. See my flame about it at UA.COM.
To develop on Linux, it's more of a hassle, but there are some decent third party emulators avaialable.
On Linux, I set up the needed class libraries in the following places:
| CLDC class libraries | /home/hqm/midp/j2me_cldc/api/classes.zip See note below, you need to unpack this file in order for the J2ME preverifier to find the classes. |
| NTT DoCoMo IAppli libraries | /home/hqm/i-jade/i-jade-p.jar Emulator library from Zentek |
| JOpt bytecode optimizer | /home/hqm/dirs/java/imode/jopt/JOPT.JAR |
I used GNU make to build my application. A build makefile looks more or less like this.
# IAppli Build scripts
#
# Henry Minsky (hqm@ai.mit.edu)
# (C) 2001 Beartronics
JOPT_JAR=/home/hqm/dirs/java/imode/jopt/JOPT.JAR
IJADE_JAR=/home/hqm/i-jade/i-jade-p.jar
PREVERIFY=/home/hqm/midp/j2me_cldc/tools/preverifier/build/linux/preverify
CLDC_CLASSES=/home/hqm/midp/j2me_cldc/api/classes
CLDC_CLASSES_ZIP=/home/hqm/midp/j2me_cldc/api/classes.zip
APP=TailApp
MAIN=TailCanvas
JARFILE=tail
RESOURCES=
# Normal compile
jar: compile
#preverify
# make jar file
jar -cvf ${JARFILE}.jar ${APP}.class ${MAIN}.class ${RESOURCES}
# Squeeze the bytecodes down with Jopt, and preverify for deployment
squeeze: jcompile
#compress
java -classpath ${JOPT_JAR} Jopt ${APP}.class ${MAIN}.class
cp ${MAIN}_o.class ${MAIN}.class
cp ${APP}_o.class ${APP}.class
#preverify
${PREVERIFY} -d . -classpath ${CLDC_CLASSES}:${IJADE_JAR}:. \
${MAIN} ${APP}
# make jar file
jar -cvf ${JARFILE}_o.jar ${APP}.class ${MAIN}.class ${RESOURCES}
compile:
jikes -classpath /usr/local/java/jre/lib/rt.jar:${IJADE_JAR} \
${APP}.java
jcompile:
javac -O -g:none -bootclasspath ${CLDC_CLASSES_ZIP} \
-classpath ${CLDC_CLASSES_ZIP}:${IJADE_JAR} \
${APP}.java
preverify:
${PREVERIFY} -classpath ${CLDC_CLASSES}:${IJADE_JAR}:. ${MAIN} ${APP}
javadoc::
javadoc -classpath ${CLDC_CLASSES}:${IJADE_JAR}:. -bootclasspath ${CLDC_CLASSES_ZIP} -d javadoc -protected ${MAIN}.java
deploy:
cp tail_o.jar ../www/squiral
cp tail.jam ../www/squiral
(cd ..; cvs commit -m "update tail app")
I expect Zev Blut's Notes on IAppli Development will come in very handy, especially with respect to constructing a legal .jam file.