Home > code > setting up a blackberry dev environment under linux

setting up a blackberry dev environment under linux

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
- Eclipse + JDE + Linux – a working environment
- How to use BlackBerry Device with Linux
- BlackBerry Development on Mac OS X

Categories: code Tags: ,
  1. Herman
    July 16th, 2010 at 14:24 | #1

    Hi

    Thank you for this.
    I’m currently stuck at step 8: install the blackberry sdk

    When I run wine the exe extracts the file but the installer is a blank form. Can’t see anything. Thought this may be a 64bit problem. Force installed wine 32bit, same problem.

    Any suggestions?

  2. July 19th, 2010 at 04:42 | #2

    hi,
    it’s not due to 64bit because i tested this on ubuntu 64.
    is your path for java set properly within wine? if you run `wine cmd` and then type javac, does it work or does it give an error? if it gives an error, update system.reg per step 5 and then try the installation again.

    if this isn’t the issue, try the last link in the post (Blackberry Development on Mac OS X) where he goes about installing the sdk another way (seemingly without the installer). alternatively, perhaps try extracting the contents of the executable and seeing if things work that way?

    am curious to know what you find…

  3. Herman
    July 20th, 2010 at 14:30 | #3

    javac works.

    I’m still trying that Blackberry dev for OS X tutorial, but the BlackBerry_JDE_PluginFull_1.1.2.201004161203-16.exe is quite different than the component package they use.

    I’ve tried extracting it but as per that OS X tutorial somethings seem missing such as docs/api folder.

    Little bit stuck.

    Thanks for your help. Greatly appreciated!

  4. July 20th, 2010 at 19:45 | #4

    i take it you also did install msxml3 and gdiplus via winetricks, right? those were the only things i had to do in order to get the installer to run… were there any messages in the wine log that looked interesting?

    another option (probably not ideal, but…) is if you have a vm running windows (or a friend with a windows box) is to install it there and then copy the relevant folder from the eclipse subdirectory there to your machine…

  5. Herman
    July 21st, 2010 at 06:43 | #5

    yes I installed gdiplus and msxml3 via wintricks. Just general errors when running wine to install the Blackberry plugin:

    Okay good idea on installing it on another machine and getting the files. will be checking that out.

  6. Herman
    July 21st, 2010 at 06:45 | #6

    errors while running “wine BlackBerry_JDE_PluginFull_1.1.2.201004161203-16.exe”:

    fixme:win:EnumDisplayDevicesW ((null),0,0x32accc,0×00000000), stub!
    fixme:win:EnumDisplayDevicesW ((null),1,0x32accc,0×00000000), stub!
    fixme:ddraw:DirectDrawEnumerateExA flags 0×00000001 not handled
    fixme:win:EnumDisplayDevicesW ((null),0,0x33ba3c,0×00000000), stub!
    fixme:d3d:swapchain_init Add OpenGL context recreation support to context_validate_onscreen_formats
    fixme:font:WineEngCreateFontInstance Untranslated charset 255
    fixme:imm:ImmGetOpenStatus (0x1c7988): semi-stub
    fixme:imm:ImeHandleNotify WM_IME_NOTIFY:IMN_SETCOMPOSITIONWINDOW
    fixme:imm:ImeHandleNotify WM_IME_NOTIFY:IMN_SETCOMPOSITIONWINDOW
    fixme:imm:ImeHandleNotify WM_IME_NOTIFY:IMN_SETCOMPOSITIONWINDOW
    fixme:imm:ImeHandleNotify WM_IME_NOTIFY:IMN_SETCOMPOSITIONWINDOW

  7. August 7th, 2011 at 23:36 | #7

    Thanx for the nice post. good idea on installing it on another machine and getting the files. will be checking that out.

  8. bala
    October 21st, 2011 at 05:34 | #8

    i have eclipse an jdk in native linux.can i try installing only the sdk under wine and still make it work?.thanks in advance.

  1. No trackbacks yet.