We’ve been working lately on a BlackBerry application, currently targeted for the 8900 Curve. Its been over a year since I last did any work on the Blackberry, so I dusted of the JDE from RIM and started to setup a fresh install of Netbeans (6.7.1) to start cranking away, how hard can it be to get things setup? Right? So, several frustrating hours later and digging up some old projects, I finally figured it out. I thought I’d post how to do it here to save someone else the pain!
Ok, so I’m going to assume you already have installed Netbeans along with the Mobility pack.
The first step is to download the JDE that you need from here, the version you need will depend on your phone. For the 8900 its version 4.6.1. So, I hear you ask, how do I know which one? Grab your Blackberry and hit Options->About and you’ll see the version number, this corresponds to the JDE version you’ll need. My 8900 gives a a version number of 4.6.1.250, hence I used the version 4.6.1 of the JDE. Note that on the about page, it also gives a Platform version number, for me this is 4.2.0.113 – ignore this.
Then, once you’ve installed the JDE check out this article over at netbeans. Although this is old, this basically works. So, follow these steps but ignore the last step where it asks you to cut and paste some stuff into your build.xml file. This part doesn’t work, at least not for me. Specifically, it would build but it would not generate the alx and cod file that you’ll need to actually run the application!
So, this was the tricky part – well, kinda. Cut and paste the following into the bottom of you build.xml file, just above the tag;
Change the first line to point to the location of the JDE that you installed. The next step is to add a alx file, this is needed to generate the cod file. We can create one manually and place in the same directory as your build file. Its name will need to be the the name of your midlet. You can find this out, or set this, by looking at your project properties. Under Application Descriptor you should see a MIDLet-Name, this will be the name of you alx file (but give it an alx extension). Don’t worry, if you get the name or file location wrong, you’ll get an error message when you try to build the app, this will tell you the expected location and name that Netbeans was expecting, which I found useful as I got it wrong a couple of times myself
You’ll also need to change the target phone, see where it says rim.blackberry.emulator, for me the target was the 8900 phone, hence the 8900 for its value.
Once you create this file, paste the following into it (but replace MyApp and MyCompany with your app name and company name, its only really important to get the name of the .cod file correct) ;
MyCompany
Copyright (c) 2009 MyCompany
MyCompany
MyApp.cod
And, that should be it (I hope!). Enjoy!