Thursday, March 12, 2009

Java ME on BlackBerry

One of the platforms you can support with Java ME is BlackBerry. BlackBerry devices are a bit different from your ordinary cellphone. They are very good at email and includes a handful of applications.

Most of the applications for BlackBerry use the native Java API, but the device also supports Java ME midlet applications. But there are a few points to note...

Create COD files
BlackBerry supports standard jar/jad files to some extent, and installing your application entering a jad URL in the phones browser might work very well. But my experience is that sometimes it doesn't. Converting the jad/jar files to BlackBerry cod file format on your PC might be a better idea.

For this you need BalckBerry Java development tools. I use BlackBerry JDE 4.6.0, but there are new versions. You find them here.

From the command line you run something like:

"C:\Program Files\Research In Motion\BlackBerry JDE Component Package 4.6.0\bin\rapc" import="C:\Program Files\Research In Motion\BlackBerry JDE Component Package 4.6.0\lib\net_rim_api.jar" codename=XXX -midlet jad=yyy.jad yyy.jar

This will take your yyy jar and jad files and create XXX.cod. It will also modify your jad file and add a lot of BlackBerry-specific lines to it. This makes the JAD file much larger, so will probably not want to use it for non-BlackBerry devices, even if the original data is still there (some devices have restrictions on jad file size).

If your midlet is large, it will be split into several cod files. They will all be in the yyy.cod, which might by a zip archive. So you need to check if it is (you can also check the modified jad file to see if there are several cod files in it). If it is you should unpack it and put the individual cod files on your web server together with the modified jad file. Make sure that the cod mimetype is configured on your web server, and your cod file is ready to install.

No comments: