IAppli Notes

Henry Minsky (hqm@ai.mit.edu)

iMode Top : IAppli Notes


IAppli Development Notes: Introduction

Here are my notes on developing an IAppli application on a RedHat 6.2 host.

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.

Development Tools

I am using the following tools

Setup of Development Tools

For developing on Windows, the Sun DoJa emulator kit provides a pretty complete emulation environment, just create a project using the Toolbar menu and start adding source code. The kit comes with some sample applications (some of which are too large to fit in the 10k byte limit of an IAppli phone! Perhaps Sun has some magic byte code compression tools that we are not privy too).

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")

Deploying

+ To get the previerifer to work, I had to unpack the j2me_cldc class library jar file, as suggested in several messages on the Keitai-L mailing list.

I expect Zev Blut's Notes on IAppli Development will come in very handy, especially with respect to constructing a legal .jam file.

References

Bookmarks

iMode

Java

Java MIDP

  • Forget Java for the UI, see Laszlo Systems, the next generation of network applications. Featuring the worlds most popular virtual machine (guess again, it's not JVM, it's not .net CLR). Or was it spelled Lazlo?

    Internet