Call me crazy but I just can’t seem to accept that if you want to (or have to) write BlackBerry software you’re stuck with Windows. It bugs me.
There is good news and bad news regarding the simulator. The good news is with a recent version of Wine you can actually get the BlackBerry simulator to run. The bad news is that it’s a bit buggy, and debugging hardly works at all.
What to expect
Your millage may vary! Generally I find that the simulator is usable for most testing. Attaching a debugger to it (via JDWP) just seems to cause the simulator to hang. Mind you, I have a rather slow system (AMD XP 2500+) and I would love to hear about your experiences if you have a faster computer.
Wine – You need the most recent version you can get your hands on. The package in the Ubuntu repository won’t due. So if you have installed this one, remove it and follow these instructions to get the latest and greatest.
For some reason until I performed the following steps, the simulator would always crash on startup:
- rm -rf ~/.wine
- Start up winecfg
- Applications tab – select Windows 2000 from the dropdown list
- Audio tab – select ALSA Driver from the drivers list
It should go without saying that you will need a copy of the JDE or one of the simulator packages. If you have access to a Windows box, just zip up the JDE or simulator and copy over. Otherwise, there are a few tricks to extracting the contents of the setup package.
Extract the setup package:
wine BlackBerry_JDE_4.2.1.exe /extract:c:\\
Which extracts the files to ~/.wine/drive_c/
Use msiexec to install the package:
wine msiexec /a c:\\jde_installer.msi /qn
Which extracts the file to ~/.wine/drive_c/Program Files/Research In Motion/BlackBerry JDE 4.2.1. This is a cumbersome path at best so move this somewhere more usable:
mv ~/.wine/drive_c/Program Files/Research In Motion/BlackBerry JDE 4.2.1 ~/lib/JDE4.2.1
Run the simulator
I created a shell script from one of the existing batch files for launching:
cat 8800.bat | dos2unix > 8800.sh
Replace the @echo off with #!/bin/bash and insert the wine command before the fledge.exe. Mine looks like this:
#!/bin/bash wine fledge.exe /app=Jvm.dll /handheld=8800 /session=8800 \\ /app-param=DisableRegistration /app-param=JvmAlxConfigFile:8800.xml \\ /data-port=0x4d44 /data-port=0x4d4e /pin=0x2100000A
Set the execute permission:
chmod +x 8800.sh
Now just run it!
Don’t give up if the first time you run it the thing crashes. Give it a few tries.
So you fancy yourself an adventurer do ya!?! Well, good luck.
Thankfully, RIM hasn’t made the same mistake with JDWP as they did with the signature tool but you will still have to modify a number of text files to convert the Windows path names to Unix ones.
cp SimPackage-JDE.rc SimPackage-JDE.orig
cat SimPackage-JDE.orig | sed 's/\(Command.*\)=%/\1=wine %/' | sed 's/\\/\//g' > SimPackage-JDE.rc
cp FixedBuild.rc FixedBuild.orig
cat FixedBuild.orig | sed 's/\(Command.*\)=%/\1=wine %/' | sed 's/\\/\//g' > FixedBuild.rc
cp DefaultBuild.rc DefaultBuild.orig
cat DefaultBuild.orig | sed 's/\\/\//g' > DefaultBuild.rc
If you copied the JDE from a Windows box you might need to update other files. You must also remove Settings.rc if it already exists.
Make sure you have the Sun Java Runtime installed by running java -version. Now all that’s left is to start up the JDWP:
java -jar JDWP.jar
On startup, there will be an error message about RIMUsbJni.dll but you can safely ignore this. And that’s just about it; your JDWP client connects as usual (jdb, eclipse, netbeans). Feel free to leave your successes/failures in the comments.