setting up a blackberry dev environment under linux
Jun 24, 2010 · 3 minute readcode
blackberrylinux
i recently had to look at the blackberry sdk for something. to my disappointment, the blackberry sdk is only available for windows - no linux or mac versions in site. my first attempt was to run a windows vm under virtualbox, but that brought my system to a screeching halt.
so i started doing some research (see sources at the bottom of the post) and found an easier way. i did this all under ubuntu linux (lucid).
1. install wine (sudo apt-get install wine
)
2. get winetricks from here (see http://wiki.winehq.org/winetricks for details).
3. chmod +x winetricks; ./winetricks gdiplus; ./winetricks msxml3
4. download and install the jdk for windows from sun (oracle?) under wine.
5. update your windows path to contain the directory of the sdk - do this by editing ~/.wine/system.reg
and searching for PATH= and appending your path to it.
6. ensure that java works under wine (ie run wine javac and see if it works - if it doesn’t, try doing a wine cmd followed by a path to see what the path is at the moment).
7. download the 32 bit eclipse for windows - unzip it and move it to ~/.wine/drive_c
.
8. install the blackberry sdk (wine BlackBerry_JDE_PluginFull_1.1.2.201004161203-16.exe
).
9. mkdir /opt/rim; cp -r ~/.wine/drive_c/eclipse/plugins/net.rim.ejde.componentpack5.0.0_5.0.0.25/components /opt/rim/sdk
10. download the sun java wireless toolkit for linux and install it in /opt/rim/WTK2.5.2
11. finally, set up a /opt/rim/tools
directory and add the following files in there (make sure to chmod +x them):
build.sh:
#!/bin/bash
SDK=/opt/rim/sdk
PREVERIFY=/opt/rim/WTK2.5.2/bin
PATH=$PATH:$PREVERIFY java -jar $SDK/bin/rapc.jar \
import=$SDK/lib/net_rim_api.jar \
codename=$1 \
$1.rapc \
*.java
9550.sh
#!/bin/bash
cd "`dirname $0`"
/usr/bin/wine /opt/rim/sdk/simulator/fledge.exe /app=/opt/rim/sdk/simulator/Jvm.dll /handheld=9550 /session=9550 /app-param=DisableRegistration /app-param=JvmAlxConfigFile:9550.xml /data-port=0x4d44 /data-port=0x4d4e /pin=0x2100000A
and that’s it! now let’s compile a sample app, say the helloworld sample (from /opt/rim/sdk/samples/com/rim/samples/device/helloworlddemo/
). to do this, copy the helloworlddemo
folder somewhere and add a HelloWorldDemo.rapc
file in that folder that looks like this:
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
now you can compile it by running /opt/rim/tools/build.sh HelloWorldDemo
- if all is well, you should see a HelloWorldDemo.cod
file.
then run 9550.sh
, which should launch the simulator. you can choose to install the cod file from the menu.
btw, if you want to use other emulators, run wine fledge.exe /help
under /opt/rim/sdk/simulator
and you’ll find what valid parameters there are for the device type. then edit 9550.sh
and change it to your device type.
one other note - another way to compile applications involves using the blackberry ant tools. i haven’t tried this yet, however.
sources