RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX


Build Your First BlackBerry Java App : Page 2

Learn how to use the freely available BlackBerry JDE to develop, debug, and test BlackBerry applications. Follow this demonstration to create a simple HelloWorld application that exploits some of BlackBerry's own APIs.

Prepare to Say Hello
Start up the Blackberry JDE by going to Start -> All Programs -> Research In Motion -> BlackBerry Java Development Environment 4.0 -> JDE. You should see the RIM development environment. Use the Files tab of the Workspace view to drill down into the com\rim\samples\device folder. There you will see a number of sample application projects that you can dissect to your heart's content. One of them is a HelloWorld application (see Figure 1).

Figure 1. Browsing Through the JDE's Samples

Since life is not very educational if everything is handed to you on a silver platter, this tutorial demonstrates how to build your own HelloWorld application—which actually does exactly what the HelloWorld application that ships as an example does.

Figure 2. Creating a New Workspace

Like many other IDEs, Blackberry projects are collectively housed in units called workspaces. Create a workspace by going to the File menu and choosing the New Workspace… option. Specify a Workspace name of HelloWorldWorkspace as Figure 2 shows. Here, you can also specify a directory in which to create the workspace. This article uses the default directory locations provided by the IDE.

Figure 3. Creating a New Project in the HelloWorldWorkspace Workspace

After creating the new workspace, choose the Project menu and then the Create New Project… option. Name the project HelloWorldProject as Figure 3 shows.

Next, choose the File menu and the New… option. In the subsequent Create new file window, make sure the Java File type is selected and specify "HelloWorld.java" for the File name, as Figure 4 shows.

Figure 4. Creating a New File Named HelloWorld.java

At this point, the IDE creates a barebones Java class with the following code in it:

package ;

class HelloWorld

Of course, this code does nothing. It is your job to populate the HelloWorld class with something worthwhile (more on that in a bit). But before that, you need to associate your HelloWorld java file with the HelloWorldProject you created earlier. To do this, simply right click in the code editor area and select the Insert into Project option. From the subsequent project selection window, choose the HelloWorldProject.

Close Icon
Thanks for your registration, follow us on our social networks to keep up-to-date