BlackBerry Development and Eclipse
Table of Contents
The purpose of this document is not to replace the official resources avalaible for BlackBerry developing using Eclipse.
I decided to look for an follow a tutorial as usual. First, however, I set up my tool stack starting with a fresh download of Eclipse (as noted below) and downloading the rather large BlackBerry Java Plug-in for Eclipse.
I used the plain Java Eclipse (click the icon to the right of this paragraph). My definitive installation became Eclipse Galileo SR2 IDE for Java Developers.
Just as I had for the Eclipse installation I'm using for Android development, I created a shortcut, then changed the icon before installing it on my taskbar. I found an icon of a bunch of grapes that, all together, looks (very vaguely) like a single blackberry here.
Remember to keep the icon around in the same place or your shortcut will lose the ability to display it. See Companion Notes for Android Development and Eclipse for greater detail. It's very handy to distinguish between my Eclipse installations in this manner.
See this document here.
It's suggested that you download all available JDEs. I'm waiting until I get more familiar with BlackBerry development. To create a BlackBerry application for a specific verion of BlackBerry, you must use a version of the BlackBerry Java Developement Environment (JDE) or component pack plug-in that matches the version of BlackBerry device software you want the application to run on.
The BlackBerry JDE download is a Windows executable that you must install before launching Eclipse. I chose to install it on the path, C:\Users\russ\dev\blackberry-eclipse, which is where my Eclipse installation is. I did this because I am in the habit of keeping my Android SDK in an analogous place.
I found the instructions about modifying configuration/config.ini to be bogus at this point. osgi.framework.extensions was already defined by the installation.
It appears that the version of Eclipse with BlackBerry tools installed is indeed the one sitting in the same folder where I installed the tools (and not an embedded one). This is because the BlackBerry installer recognizes that you've already got Eclipse installed and ready to go.
From this point on, the BlackBerry document, The BlackBerry JDE Plug-in for Eclipse, is inaccurate in that it doesn't exactly match some of the current Galileo interface details. So I followed a recommended video tutorial, here, put together using Europa. This explained a number of things even though very out of date.
This is the tutorial I first follow, mostly to work the kinks out of my installation, configuration and expectations. The simulator is much better than the one for Android, but it's also more complicated and there are many different simulators meant to permit considering the myriad types of BlackBerries in your development. Sheesh. This is just what I wanted to do. NOT!
In creating the project, I did not have the opportunity to intervene in the BlackBerry JDE set-up as demonstrated, because this configuration option was missing. After the project was created, neithere project-specific properties nor workspace properties showed any configuration similar to what the presenter was explaining.
The presenter magically has some HelloWorld code in his temporary buffer which he pastes in without explaining how it got there. I found nothing on how to do this, but when the project was created (in Galileo), a welcome page (that can be turned on or off via BlackBerry configuration in the workspace properties and/or at Help -> Open BlackBerry Getting Started Page) has internal help links to creating a basic HelloWorld application.
It's important that when you create the HelloWord class, you follow the "extra" steps very carefully. These include specifying the superclass and the stubbed methods you want.
For my first launch, I was perplexed. For my instructions, I'm using the Eclipse-hosted Help accessed from the BlackBerry Getting Started page.
To reach the Downloads folder, you have to start by clicking the Media icon on the main screen, then back out of that by clicking the Return (or Back out) Arrow, only then will the screen display the Downloads folder.
Inside the Downloads folder, you'll find the HelloWorld application. No amount of clicking on this application would cause it to launch. This is because the Eclipse BlackBerry Help isn't careful about how it tells you everything you must do (as if it were an orderly tutorial). You must pay careful attention and understand everything it says before coding. Don't do it ad hoc. Or, click on the last Help entry, "Code sample: Creating a Hello World application." Likely, you'll find that you needed to include in main() the following:
HelloWorld theApp = new HelloWorld(); theApp.enterEventDispatcher();
Ultimately, I got a JVM error:
...which I took as a sign that I would need to observe much more carefully the source code. I went back to compare what was in the sample source with what I had and found nothing, though I added all the comments in for posterity. Then I cleaned, built and ran again and it worked.
The main BlackBerry (commercial) site is here—not too relevant.
BlackBerry development software is something you must sign up for. The download is 368Kb in size.
Here's one of the official tutorial projects, the "A11 User Interface" project. It's supposed to look like this:
Once the code is typed in (and the lessons learned, hopefully), this appears
(click to see full-size image).
There is a keyboard covering the bottom pane (containing the three buttons).
Using the device menu (click the "BlackBerry" icon at the bottom, to the right
of the green "on" button), you can get rid of the keyboard.
However, once hidden, the buttons were not there. After debugging, it became
obvious that the
fieldManagerBottom.add() calls had not been done.
The working application appears (with a changed capital city) in the last image