Devel on a BlackBerry device

JDK Installation

I use the JDK from SUN. With debian, it’s quiet easy to use it.

[root@Dahlia root]$ aptitude install sun-java6-bin sun-java6-demo \
sun-java6-doc sun-java6-jdk sun-java6-jre sun-java6-plugin

JDE Installation

Before install JDE on Linux, I have installed it on Windows. I haven’t success install with WINE tools.

[root@Dahlia root]$ mkdir -p /opt/RIM
[root@Dahlia root]$ cp -R /mnt/win/Program\ Files/BlackBerry\ JDE\ 4.7.0/ /opt/RIM/sdk

Then, I need Java Toolkit from SUN (
I have installed this tool in /opt/RIM/WTK2.5.2.

[root@Dahlia root]$ sh

Build COD application

To be able to build COD application from the sources (JAVA files) and a project file (RAPC file), I have written a little script.

[root@Dahlia root]$ mkdir -p /opt/RIM/tools
[root@Dahlia root]$ cat > /opt/RIM/tools/


PATH=$PATH:$PREVERIFY java -jar $SDK/bin/rapc.jar \
   import=$SDK/lib/net_rim_api.jar \
   codename=$1 \
   $1.rapc \

Now, for the sample, I’m going to build the HelloWorld sample from the SDK.

[root@Dahlia root]$ mkdir project
[root@Dahlia root]$ cd project
[root@Dahlia project]$ cp -R /opt/RIM/sdk/samples/com/rim/samples/device/helloworlddemo .
[root@Dahlia project]$ cd helloworlddemo
[root@Dahlia helloworlddemo]$ cat > HelloWorldDemo.rapc
MIDlet-Name: HelloWorldDemo
MIDlet-Version: 0.9
MIDlet-Vendor: Research In Motion Ltd.
MIDlet-Jar-URL: HelloWorldDemo.jar
MIDlet-Jar-Size: 0
MicroEdition-Profile: MIDP-2.0
MicroEdition-Configuration: CLDC-1.1
MIDlet-1: Hello World Demo,img/helloworld_jde.png,
RIM-MIDlet-Flags-1: 0
[root@Dahlia helloworlddemo]$ /opt/RIM/tools/ HelloWorldDemo

Build Midlet application

With JDE, you can convert JAVA midlet to COD files.
To make this, I have written a little script.

[root@Dahlia root]$ mkdir -p /opt/RIM/tools
[root@Dahlia root]$ cat > /opt/RIM/tools/


PATH=$PATH:$PREVERIFY java -jar $SDK/bin/rapc.jar \
   import=$SDK/lib/net_rim_api.jar \
   codename=$1 \
   -midlet \
   jad=$1.jad \


[root@Dahlia root]$ /opt/RIM/tools/ HelloWorldDemo

Signing Java applications

The last step is using the signature tool from the JDE.

First, you have to register you RIM’s developper to get your keys. You will receive three keys RBB, RCR and RRT :

  • client-RBB-1234567890.csi
  • client-RCR-1234567890.csi
  • client-RRT-1234567890.csi

To use keys, you have to register with JDE tool. During the registration process, you have to be online. You have to enter your PIN code and a passphrase.
WARNING, you have to use the same PIN code and the same passphrase for each key.

[root@Dahlia root]$ cd /opt/RIM/sdk/bin
[root@Dahlia bin]$ chmod 644 sigtool.*
[root@Dahlia bin]$ java -jar SignatureTool.jar client-RBB-1234567890.csi
[root@Dahlia bin]$ java -jar SignatureTool.jar client-RCR-1234567890.csi
[root@Dahlia bin]$ java -jar SignatureTool.jar client-RRT-1234567890.csi

Now, you are ready and you can sign your applications.

[root@Dahlia root]$ cd /opt/RIM/sdk/bin
[root@Dahlia bin]$ java -jar SignatureTool.jar

Debug Java application

It’s possible to use your BlackBerry device to debug step by step your Java applicationser. I’m writting a tool to plug JDB client (or other) to the embedded JVM into your mobile phone.

This tool is still in current developpement. Some features can be used and are available in the last Barry releases.

We are going to use the previous HelloWorldDemo sample.

[root@Dahlia helloworlddemo]$ /opt/RIM/tools/ HelloWorldDemo
[root@Dahlia helloworlddemo]$ ls*             HelloWorldDemo.cso    HelloWorldDemo.jar    HelloWorldScreen.class
HelloWorldDemo.class  HelloWorldDemo.debug*  img/
HelloWorldDemo.cod    HelloWorldDemo.jad    HelloWorldDemo.rapc*  Makefile

Rapc has generated several files… whom some interresant. The HelloWorldDemo.cod file will be install on our BlackBerry device and the HelloWorldDemo.debug file will be used to debug.

[root@Dahlia helloworlddemo]$ bjavaloader load HelloWorldDemo.cod
loading HelloWorldDemo.cod... done.

To be able to debug, we have to run the bjdwp command in the same directory where is the HelloWorldDemo.debug file. If you wish to debug several applications, copy all your “.debug” files in a same directory.

[root@Dahlia helloworlddemo]$ bjdwp localhost 8000

Then, you can use a Java debugger (Eclipse, JDB or others) :

[root@Dahlia root]$ jdb -connect com.sun.jdi.SocketAttach:hostname=localhost,port=8000

The bjdwp tool generates several traces, whom the console message (the “System.out.println” output).

This entry was posted in BlackBerry, Linux and tagged , , , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *