WTK
- Windows PC: WTK 2.5.2
- Mac: WTK 2.5.2 Linux version, copied preverify from JavaME SDK 3.0 Mac
Build tool is Antenna
- Windows: antenna 1.1.0
- Mac: antenna 1.2.1 ( the earlier versions have preverify issue on Mac )
Actually we usually build J2ME application on windows or Linux box, this is the first time to build on Mac. I checked the build log, the log shows the preverify error.
Since I used Sun's latest version of preverify file for Mac, I never suspect it might have issue. I thought issue might due to Mac is picky with the Antenna build script, so I spent lots of time trying to tweaking the build script, but no luck. So I started to thinking the problem might be the preverify file I used for Mac.
Finally I have to google and I was so lucky that I found Sam's blog post: J2ME Development on OS X, revisited. This is a fantastic article, the most important for me is he tells me how to get the Mac version of preverify: Download the phoneME project source code, and the preverify for mac is under phoneme_feature/cldc/build/share/bin/darwin_powerpc/, as the author suggested, I downloaded the PhoneME feature M2 source code, and I did found the preverify, and after I copied the preverify in my WTK /bin folder of my mac machine, then when I run the build script, it works, awesome. I really admire this guy, how could he find out this tool!
Now let me describe how to install WTK 2.5.2 on Mac in step by step, please note this only works if you still use WTK 2.5.x, and it is only useful for building the application, the emulator and other tools are not working, you can use JavaME SDK 3.0 for Mac, but based on my today's experience, its preverify still has issues:
Download and Install the WTK 2.5.2
- Goto here to download the Sun's WTK 2.5.2 for Linux, file is called sun_java_wireless_toolkit-2_5_2-linux.bin
- Execute the downloaded file (sh sun_java_wireless_toolkit-2_5_2-linux.bin)
- When asked for a path to JDK, enter “/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home/bin/”
- Follow the instructions, probably best to install into /Applications/WTK2.5.2
Get the preverify binary
- Download the PhoneME project feature source code, choose the M2 source bundle
- Extract phoneME build, it creates a directory called “phoneme_feature”
- Copy /phoneme_feature/cldc/build/share/bin/darwin_powerpc/preverify and overwrite the preverify binary in your WTK bin folder.
- You might need to change the permission to w+x of preverify.
Today one of my colleague found this issue on this macbook, when I give him a copy of preverify binary file, when he run it on his machine, it prompt need to install Rosetta to run it. it said the Rosetta comes with the MacOS installation CD, so if you have the similar issue, then install it first.
Other tools:
Antenna: please use the latest version for Mac (1.2.1).
Gant: the groovy based DSL for build script, it built-in support all the ant tasks, but you don't need to write XML any more, I just started using it, and I love it.