Hello BlackBerry!

It’s been my experience that all MIDP implementations are different, but some are more different than others.  BlackBerry Java smartphones are MIDP compliant, but they have a particularly unique flavor of MIDP.  They’re also becoming increasingly popular, so I decided it was time to get one and try it out.  Here’s my new (to me, actually used) BlackBerry 8700g:

BlackBerry_8700g

By selecting “options > about” I got the convenient info screen above, which tells me that the version is 4.1 — one of the oldest BlackBerry handsets with Java.  (That’s OK, all the better to test backwards compatibility.)

The first (and IMHO most annoying, but critical) step is to set up the development environment and get a complete “Hello World!” from code on the PC built and running on the device.  Here’s my “road to Hello World” — the problems I encountered and their solutions — in hopes of saving the next person some time:

My first step was to load a few of my simplest sample MIDlets onto the device to see if they work.  The Key Codes MIDlet worked fine — providing interesting information about which keystrokes the MIDlet can receive and which keystrokes are handled by the operating system while the MIDlet is running.  The JSR Test MIDlet also worked and provided interesting information (once I figured out that the MIDlet commands are mapped to the trackwheel and that you press in the trackwheel itself to select).  Installation was a breeze — just click on the Jar file’s URL in the browser, and the BlackBerry takes care of it.  My simplest game — the Maze game — didn’t quite work, though, so I figured the next step was to download the BlackBerry-specific development utilities.

On the BlackBerry Java Application Development Tools & Downloads page, there are two choices:  an Eclipse plugin, and a “legacy” standalone IDE.  (I found this page through the Java Application Developers page — you may need to create an account and log in to see the development tools pages.)  I assume the word “legacy” here means that they don’t intend to keep supporting it and they mean for you to switch to the Eclipse plugin.  I tried them both, and I liked the standalone IDE better.

First, the Eclipse plugin.  The spot where I wasted the most time was in trying to install the plugin into Eclipse 3.5 “Galileo”.  If you read the getting started guide, it specifically states that the plugin works in Eclipse version 3.4.  I assumed that it would also work on version 3.5 since the BlackBerry JDE Plugin for Eclipse page actually links to a download of Eclipse 3.5, and I just followed that link.  But, when trying to install the plugin, I got the following error message:

To: net.rim.eide.componentpack4.7.0 [4.7.0.46]

Cannot complete the install because one or more required items could not be found.
Software being installed: BlackBerry Component Pack 4.7.0 4.7.0.46 (net.rim.eide.feature.componentpack4.7.0.feature.group 4.7.0.46)
Missing requirement: BlackBerry JDE Plug-in for Eclipse 1.0.0.67 (net.rim.eide 1.0.0.67) requires ‘bundle org.eclipse.core.resources [3.4.0,3.5.0)’ but it could not be found
Cannot satisfy dependency:
From: BlackBerry JDE Component Package 4.7.0 4.7.0.46 (net.rim.eide.componentpack4.7.0 4.7.0.46)
To: bundle net.rim.eide 0.0.0
Cannot satisfy dependency:
From: BlackBerry Component Pack 4.7.0 4.7.0.46 (net.rim.eide.feature.componentpack4.7.0.feature.group 4.7.0.46)

It looks like the plugin required a particular set of Eclipse core resources that it couldn’t find, which is the sort of thing that smells like a version mismatch.   A little googling found me a site where I could download the Eclipse 3.4 “Ganymede” version, and the plugin installed in that Eclipse version just fine, according to the instructions in the links above.

the first drawback to the Eclipse plugin, however, is that it doesn’t appear to come with any sample code (or if it did, it’s well hidden).  For that reason alone, you might as well download the BlackBerry JDE since it comes with a big pack of sample apps.

Installing the BlackBerry JDE, building the sample apps, and running them in the simulator was pretty straight-forward.  There was one point, however, where I found the BlackBerry development environment – development guide to be a bit lacking.  I felt like it should more clearly answer the following basic questions:

  1. Does the “project > build” command build the file that can be installed directly onto my device?
  2. If so, where is it???

I poked around a bit, and found the built .cod files in the same folder with the source code, interestingly enough.  For the “Hello World” sample, that was “C:\Program Files\Research In Motion\BlackBerry JDE 4.1.0\samples\com\rim\samples\device\helloworld\com_rim_helloworld.cod”

Then the last step is to install it on the BlackBerry.  Fortunately, the BlackBerry JDE came with a simple little command-line utility called “JavaLoader.exe” to install applications from the PC onto the BlackBerry device.  So I connected the device via USB cable to my PC, allowed the PC to find an appropriate driver, and tried “JavaLoader -u dir” (to get the directory listing with the “-u” option indicating that I’m connecting via USB).  Unfortunately, I got this crazy message:

Error: unable to open port

Sadly, no hints as to why it couldn’t open the port, so the next stop was to search the BlackBerry developer forums.  This is the place to go — a quick search turned up the problem immediately:  you need to be running the “BlackBerry Desktop Manager” in order for the JavaLoader to find the device.  My used BlackBerry came with a couple of cables but no software, so again I turned to my old pal Google.  I tried downloading two versions of the “BlackBerry Desktop Manager” for BlackBerry 4.1 from the BlackBerry site, and — this is the weirdest part of the whole adventure — I received some entirely different program instead.  Not sure why.  But cnet.com provided a link to a version of the Desktop Manager “tested spyware free”, and that one worked.  Yay!  With that desktop manager running, JavaLoader was able to connect to the device and load com_rim_helloworld.cod onto it.

That should be the last step, right?

Sadly, no. The HelloWorld application appeared on my main BlackBerry menu, but when I launched it, it threw an Exception!  It failed to find its resource bundle!  So I opened up the source code to see what was the problem.  It turned out that it was importing packages from another sample application: “com_rim_demores.cod”.  This is just a philosophical point, but I think the “Hello World” demo should be the simplest possible application — leave the best practices about internationalization for step 2 — but that’s just me.  Anyway, with the resource demo application installed, the “Hello World” finally worked on my BlackBerry!

Now on to some actual development…

13 comments so far

  1. Jimmy on

    Yeah, I’ve found that BlackBerry makes a lot of things difficult. Particularly as an end user trying to use email, I’ve found that they make it difficult and sometimes expensive, where other products make it easy and free (iPhone and Windows Mobile). The BB path to development is confusing. I’m not as far along as you but I’ve already spend a good bit of time and been down some dead end roads in my research.

    Thanks for this post. It will help me as I move forward on my journey of learning BB development.

  2. joseph on

    you can vote for the support on https://www.blackberry.com/jira/browse/TOOL-14

  3. Mario Zorz on

    Hi

    I ran accross this same issue today, I wonder why RIM makes it so difficult!
    Thanks a lot for the post Carol, I will follow these lines to make this work.

    Thanks
    Regards
    Mario

  4. Mario Zorz on

    Another comment: the official older versions of Eclipse can be found here:
    http://wiki.eclipse.org/Older_Versions_Of_Eclipse

  5. Anil on

    I dont know why the BB guys are wasting poor developers time. I wasted almost 2 days trying to figure out why the eclipse plugin doesn’t work. I was getting the message “Cannot complete the install because one or more required items could not be found.”

    If its not the right IDE, why does anyone want to put a link to Eclipse Galileo?

    “RIM is getting more arrogant.” 🙂

    really bad time for us developers.

    Anil

  6. Obvious Pseudonym on

    If you dev for iPhone, you’ll never understand how software as unpolilshed as this gets released. Dreading this upcoming port project (iphone->blackberry).

  7. carolhamer on

    I agree with the comments about BlackBerry being unpolished. It’s very much like bleeding-edge software all the time (even parts that have been around long enough that you’d expect them to be mature). The BB platform does a lot of amazing things, but much of its behavior is counter-intuitive — and the documentation is surprisingly poor in organization, clarity, and completeness.

    But don’t despair!

    If you’re planning a BlackBerry project, just pick up a copy of Learn BlackBerry Game Development! (Even if your app isn’t a game, this book will help.) Andrew and I spent countless hours figuring out the steps and pitfalls of a BlackBerry project so you won’t have to waste your time on the parts that ought to be simple. 😉

  8. […] Hello BlackBerry! […]

  9. Ernestina on

    OU

  10. Tommie on

    NN

  11. my hometown on

    My brother suggested I would possibly like this website.
    He was once totally right. This put up actually made my day.
    You cann’t imagine simply how so much time I had spent
    for this information! Thank you!

  12. Minimally invasive Surgery on

    Hello to every one, for the reason that I am actually eager of reading this web site’s
    post to be updated daily. It consists of good stuff.

  13. Dann on

    Whats up very nice web site!! Guy .. Beautiful ..
    Amazing .. I’ll bookmark your site and take the feeds
    also? I’m glad to find numerous helpful information right here in the post, we’d like develop extra techniques on this regard,
    thanks for sharing. . . . . .


Leave a reply to joseph Cancel reply