Sunday, September 5, 2010

BlackBerry targeting older versions

Development Environment


Because of the large number of existing BlackBerry users still using older devices, we must target our official releases at OS 4.2.1. This means we won't have access to some of the newer APIs that might make our job easier, such as those that support SQLite databases (new in OS 5.0).



With the release of the BlackBerry JDE Plug-in for Eclipse 1.1, component packs older than 4.5.0 are not available on the standard update site. As of 26-Jun-2010, component packs for 4.3.0 and 4.2.1 are available on the update site for the Beta version of the 1.1 JDE plug-in. The Beta update site is located at http://na.blackberry.com/eng/developers/devbetasoftware/jar/3.5/java.



To target OS 4.2.1, there are a few options:



1.Add the BlackBerry JDE plug-in for Eclipse 1.1 Beta update site.

2.Configure the BlackBerry JDE Plug-in for Eclipse v1.1 to use the 4.2.1 Component Pack from the 1.0 plugin.

3.Use an existing installation of the BlackBerry JDE Plug-in for Eclipse v1.0

4.Target a later version, but only use APIs supported by 4.2.1

5.Use the 4.2.1 BlackBerry JDE

Using the 4.2.1 BlackBerry JDE

There's not much to say here. Just install the JDE and configure a project using the source files from the Subversion repository.



Using the BlackBerry JDE Plug-in for Eclipse v1.0

This tool is being discontinued by RIM. While you can still download the plug-in itself, it's no longer possible to obtain the 4.2.1 Component Pack from RIM's web site. If you don't already have it installed you cannot use this option.



Targeting a later OS version

You can use tools that support newer OS versions, including the BlackBerry JDE Plug-in for Eclipse v1.1, but refrain from using any APIs not supported by 4.2.1. The Blackberry API Javadoc indicates the minimum OS for each class and method it describes. If you select this option you may contribute source code to the project but you will be unable to test against a 4.2.1 simulator.



Configuring the BlackBerry JDE Plug-in for Eclipse v1.1 to use a 4.2.1 Component Pack from the v1.0 plugin

Note: You must have a previous install of the BlackBerry JDE Plug-in for Eclipse v1.0, including the 4.2.1 Component Pack. The component pack can no longer be obtained from the BlackBerry web site.



Install Eclipse IDE for Java Developers 3.5

Install Blackberry JDE Plug-in for Eclipse 1.1

Copy net.rim.eide.componentpack4.2.1_4.2.1.17 folder from Eclipse 3.4.1 plugins directory to Eclipse 3.5 plugins directory.

Create a text file with the following content:

-Dee.home=C:\Program Files (x86)\Eclipse 3.5\plugins\net.rim.eide.componentpack4.2.1_4.2.1.17\components

-Dee.executable=${ee.home}\simulator\fledge.exe

-Dee.bootclasspath=${ee.home}\lib\net_rim_api.jar

-Dee.javadoc=file:${ee.home}\docs\api

-Dee.language.level=1.3

-Djava.home=${ee.home}

-Dee.name=BlackBerry JRE 4.2.1

-Dee.description=BlackBerry Java API Definitions, simulators and utilities for BlackBerry smartphone OS version 4.2.1.17

-Dee.copyright=Copyright (c) Research In Motion Ltd. 1997-2009 All Rights Reserved.

-Dee.output.folder.suffix=4.2.1Be sure to edit the path in the first line if you've installed Eclipse 3.5 in a different directory. Save this file in the directory indicated in the first line. Name it BlackBerry.ee.



Configure Eclipse to use the 4.2.1 Component Pack

Open Eclipse 3.5.

Open Windows -> Preferences, then navigate to Java -> Installed JREs.

Click Add...

Select "BlackBerry Execution Environment VM" and click Next

Click the "File..." button next to Definition File and browse to the BlackBerry.ee that you created eaarlier.

Click Finish

You should now be able to target BlackBerry OS 4.2.1 with the Eclipse 4.5 IDE and the BlackBerry JDE Plug-in 1.1.

BlackBerry Articles