Thursday, June 11, 2009

Converting a J2ME MIDlet to a BlackBerry COD

Converting a J2ME MIDlet to a .COD involves the following steps:

  1. Download and install the RIM Java Development Environment
  2. Download and install Java SDK
  3. Copy the jad & jar files in question to the /bin/ directory of your BlackBerry JDE installation
  4. From the command line (make sure you are in the bin directory of your RIM JDE installation) type:
rapc import=“$your_JDE_dir\lib\net_rim_api.jar" codename=$your_app -midlet jad=$your_app.jad $your_app.jar
Where,
$your_JDE_dir  - is the directory of your RIM JDE installation,
$your_app          - is the name of the MIDlet you're trying to convert $your_app.jad        - is the name of the MIDlet descriptor and
$your_app.jar     - is the name of the MIDlet jar file
  1. The following files are generated:
$your_app.debug
$your_app.cod
  1. $your_app.cod is used to load the application onto the BlackBerry 
 To load the application onto the BlackBerry Simulator:
  • Launch the BlackBerry Device Simulator by selecting Start => Research In Motion => BlackBerry JDE => Device Simulator.
  • Once the simulator is loaded, install the .cod file by selecting File => Load Java Program and load the $YOUR_APP.cod from $JDE/bin/
  • On the BlackBerry Simulator desktop find your application and launch it. 

No comments: