Friday, October 31, 2008

MIDlets on the BlackBerry


Running Existing MIDlets on the BlackBerry:

To run a standard MIDlet on a Java-enabled BlackBerry device these steps are following:

1. Convert into COD file-

You first need to convert the .jad and .jar files to the .cod format, using the rapc command-line tool that comes with RIM's JDE. You'll find rapc in the bin directory of your JDE installation. This command converts a MIDlet named xxxxMIDlet:

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

2. Load COD file into BlackBerry-

You can load the resulting xxxxMIDlet.cod file into your BlackBerry device from your desktop computer over a USB cable. Use the javaloader command, which can also be found in the bin directory of your JDE installation. Use this command to load xxxxMIDlet.cod into BlackBerry:

javaloader -usb load xxxxMIDlet.cod

Once the application is loaded into the BlackBerry, you can run it just as if it were a native application.

3. Delete COD file from BlackBerry-

You can use javaloader to delete applications from the BlackBerry as well as to load them. This command will remove xxxxMIDlet.cod from the BlackBerry:
javaloader -usb erase -f xxxxMIDlet.cod

Deploying BlackBerry Applications Over the Air

You can download both standard MIDlets and BlackBerry-specific applications applications over the air, wirelessly. The provider puts up on a server both a .jad file to describe the application, and either a .cod or a .jar file holding the application itself. To download, you select the .jad file from a browser.
To enable you to download standard MIDlets to a BlackBerry, the Mobile Data Service feature of the BES provides a built-in transcoder that converts .jar files into .cod files. Note that the web server must identify the MIME types for .jad and .cod files, text/vnd.sun.j2me.app-descriptor and application/vnd.rim.cod respectively.
Be aware that you can download a .jar file to a BlackBerry only if the MDS feature is enabled, so it can convert the file to .cod format. If your access to the network is through a WAP gateway, you can download only .cod files.

For more information:
J2ME
Research In Motion (RIM)
BlackBerry Java Development Environment (JDE)
BlackBerry Developer Journal
A comparison of BlackBerry Devices
BlackBerry ISV (Independent Software Vendor) Alliance Program
BlackBerry Forums
BlackBerry Solutions from Nextel
BlackBerry Solutions from Telus Mobility T-Mobile BlackBerry Service Plans