Now this process isn’t 100% ideal. If you are an experienced developer you probably already know you need four key components.
- Rapc compiler
- Signature tool
The first two components works fabulously in Linux. The second (signature tool) needs a kick in the pants to work (shame shame shame!).
And the fourth I just can’t get past. There is the barry project which has made impressive progress in the last few months and lists javaloader support as on the roadmap for milestone 4. RIM, if you have any sympathy for us non-windows users show these guys some love and send them some specs for heaven sakes!
This article presents the basics for compiling, signing, and debugging BlackBerry applications with Linux.
First you need a copy of the JDE or the JDE components package. In my last article I covered a method of extracting the install packages distributed by RIM, but if you have access to a Windows box copying the installed JDE works just fine too.
The rapc compiler needs two external commands:
- Java Compiler (javac)
- Preverification Tool (preverify)
Install the Sun JDK to get javac:
sudo apt-get install sun-java5-jdk
The preverify command can be obtained by downloading the Sun WTK.
chmod +x sun_java_wireless_toolkit-2_5_2-linux.bin
For some reason this package complains it can’t find Java interpreter. If this happens, the Java 5 JDK is located /usr/lib/jvm/java-1.5.0-sun/bin on Ubuntu.
Once extracted, unless you plan on doing vanilla J2ME development, you can copy the preverify tool and then delete the WTK.
cp ~/lib/WTK2.5.2/bin/preverify* ~/bin
rm -r ~/lib/WTK2.5.2
Don’t forget to put the ~/bin directory in the execution path. To have this set automatically each time you login, put this line in your ~/.bash_profile file (create it if necessary).
Compile “Hello, World!”
I’ll be using Apache Ant for building because it’s the common denominator when it comes to building Java projects (like it or not). Most IDE’s have some level of support for running ant scripts.
sudo apt-get install ant
Download bb ant tools and put it where ant can find it:
mkdir -p ~/.ant/lib
cp bb-ant-tools.jar ~/.ant/lib
Download the hello world project and run "ant" in the project directory:
tar -xzf hello.tar.gz
Output from the ant should look something like this:
josh@ubuntu:~/hello$ ant Buildfile: build.xml build: [mkdir] Created dir: /home/josh/hello/build [rapc] Compiling 1 source files to ca_slashdev_hello.cod BUILD SUCCESSFUL Total time: 1 second
To sign your cod files, follow my guide on how to fix the signature tool. Then just run the sign target in the build script.