Pin Me

How to Start Developing Java Applications for BlackBerry Devices: Working with Devices

written by: crisbbdev•edited by: Simon Hill•updated: 6/18/2010

This article explains how to deploy a BlackBerry Java application example with Eclipse in a real device. It covers a Desktop Manager installation and an OTA installation.

  • slide 1 of 3

    Device Set Up

    After learning how to install and launch our helloworld app using the simulator in the previous article, let’s learn how to do it using a real device.

    There are some different ways to get your app installed on a device. In this article we’ll focus on two of them: using the BlackBerry Desktop Manager, and an OTA (over the air) installation.

  • slide 2 of 3

    Using Desktop Manager

    BlackBerry Desktop Manager is a PC tool that provides you with a way to interact with your device from your PC. You can download it from the RIM web page. Remember that you are required to be registered as a developer before you can download files from there.

    Once installed and launched let’s come back to our Eclipse IDE and its sample project HelloWorldDemo. In the previous article, what we did was just build and run the project with a run configuration in which there was a specific simulator selected. This time, we have to build our project by clicking on

    Project>BlackBerry>Package All

    This creates a “.alx” file in our project folder, inside /HelloWorldDemo/deliverables/Standard/ which is the file required by Desktop Manager to install an application.

    Now that we have created our file and we know where it is, we have to connect our device to the PC and check that the Desktop Manager has detected it. The device will be correctly connected to the Desktop Manager if we are able to see our BlackBerry PIN at the bottom of the Desktop Manager main window. After checking the PIN is ok, select:

    Application Loader>Add/Delete applications

    From there you have to look for and select the build .alx file of the application you want to install. In our case, select your “HelloWorldDemo.alx” from the path we pointed at before, and follow the steps of the installation progress.

    You can check later if everything was ok by launching your application in the same way you did it with the simulator:

    Options>Downloads>HelloWorld

    Note: You’ll probably get a permissions message when you first launch the HelloWorld demo. Don’t worry about this right now, we’ll talk about how to deal with permissions in following articles.

  • slide 3 of 3

    An OTA installation

    If your device is Wi-Fi capable or you have a data plan (and probably you do because you have a BlackBerry) you’ll be able to connect to the internet and download any application from any server provided it is correctly configured.

    Server Configuration:

    On your server, you should add the specific MIME types as follows:

    cod application/vnd.rim.cod

    jad text/vnd.sun.j2me.app-descriptor

    jar application/java-archive

    Then, place the following files on your server:

    HelloWorldDemo.cod

    HelloWorldDemo.jad

    You can find these files in your project folder because they are also created each time you build your project as we saw before (/HelloWorldDemo/deliverables/Standard/5.0.0).

    • .cod files are the compiled classes in required BlackBerry format.
    • .jad is a Java descriptor file which gives the device browser the information it needs to find the files to install and other useful data. Right now just make sure you put both files under the same path on your server.

    Now you can open your device browser and connect to the URL that points to your .jad file hosted by your server. The browser will recognize a new application and install it on your device. Once installed, you can launch it the same way we did before.