Saturday, December 09, 2006

j2me pre-verifier on os x

Development is not that difficult as you think.

I have work on j2me development back in year 2000, j2me is very new at that time. There is no such things as MIDP (Mobile Information Device Profile), there is no available phone which support java. We use an j2me GUI call spotlet, running on a Palm device.

After that I have lost track with j2me development for a few years time, I almost forgotten how to develop a j2me application. I have tried to pick up some mobile development skills at the beginning of this year but the progress is very slow.

Recently I was inspired by Gmail java client, I think may be I should refresh my j2me development skills. A few years back I develop j2me program on Linux platform and this time I want to try it on Mac OS X, but I encounter some problems with the development tools.

A j2me program is just like your normal java program, it can be compiled by a normal (J2SE) java compiler. You need an extra step to create a j2me program, pre-verify the java class object, using the j2me pre-verify tools.

When a java program loaded, it must be verify (for security, valid classes etc.), but the verify process need a lot of resources (cpu power, memory), is difficult to implement on a mobile device. A j2me program need to be pre-verify before it was loaded into a j2me virtual machine, this can be done by a pre-verify tool.

SUN java wireless toolkit came with a pre-verifier, the toolkit is available on Windows, Linux and Solaris platform. Michael Powers have ported the toolkit on Mac OS X, if you are interested to know how to do it, refer to Do-It-Yourself MIDP on Mac OS X. The pre-verifier on OS X, need a X Window library to run. The X11 on OS X is a 43MB download, after installed is about 100MB, which I don't think is necessary.

I download j2me source, and compile it myself. The source is available at Sun website, you need a login account and registration is free, it was license under Sun Community Source License (I expect it will be release soon as GPL?).

The binary is about 160k in size, and it doesn't need a X11 to execute. This is a quick and dirty hack for my own use, it work for me, but not sure it will work for all time.

I am looking for some place to upload this file.

No comments: