You are on page 1of 44

BlackBerry JDE Plug-in for Eclipse

version 1.0

Online help
BlackBerry JDE Plug-in for Eclipse version 1.0 Online help

Last modified: 1 October 2008

Part number: 15350540

At the time of publication, this documentation is based on BlackBerry JDE Plug-in for Eclipse version 1.0

Send us your comments on product documentation: https://www.blackberry.com/DocsFeedback.

©2008 Research In Motion Limited. All Rights Reserved. The BlackBerry and RIM families of related marks, images, and symbols are the
exclusive properties of Research In Motion Limited. RIM, Research In Motion, BlackBerry, “Always On, Always Connected” and the “envelope in
motion” symbol are registered with the U.S. Patent and Trademark Office and may be pending or registered in other countries.

Eclipse is a trademark of Eclipse Foundation, Inc. Java and JavaDoc are trademarks of Sun Microsystems, Inc. Microsoft, Vista, and Windows are
trademarks of Microsoft Corporation. All other trademarks are the property of their respective owners.

The BlackBerry smartphone and other devices and/or associated software are protected by copyright, international treaties, and various
patents, including one or more of the following U.S. patents: 6,278,442; 6,271,605; 6,219,694; 6,075,470; 6,073,318; D445,428; D433,460;
D416,256. Other patents are registered or pending in the U.S. and in various countries around the world. Visit www.rim.com/patents for a list of
RIM (as hereinafter defined) patents.

This documentation including all documentation incorporated by reference herein such as documentation provided or made available at
www.blackberry.com/go/docs is provided or made accessible "AS IS" and "AS AVAILABLE" and without condition, endorsement, guarantee,
representation, or warranty of any kind by Research In Motion Limited and its affiliated companies ("RIM") and RIM assumes no responsibility
for any typographical, technical, or other inaccuracies, errors, or omissions in this documentation. In order to protect RIM proprietary and
confidential information and/or trade secrets, this documentation may describe some aspects of RIM technology in generalized terms. RIM
reserves the right to periodically change information that is contained in this documentation; however, RIM makes no commitment to provide
any such changes, updates, enhancements, or other additions to this documentation to you in a timely manner or at all.

This documentation might contain references to third-party sources of information, hardware or software, products or services including
components and content such as content protected by copyright and/or third-party web sites (collectively the "Third Party Products and
Services"). RIM does not control, and is not responsible for, any Third Party Products and Services including, without limitation the content,
accuracy, copyright compliance, compatibility, performance, trustworthiness, legality, decency, links, or any other aspect of Third Party Products
and Services. The inclusion of a reference to Third Party Products and Services in this documentation does not imply endorsement by RIM of
the Third Party Products and Services or the third party in any way.

EXCEPT TO THE EXTENT SPECIFICALLY PROHIBITED BY APPLICABLE LAW IN YOUR JURISDICTION, ALL CONDITIONS, ENDORSEMENTS,
GUARANTEES, REPRESENTATIONS, OR WARRANTIES OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION, ANY
CONDITIONS, ENDORSEMENTS, GUARANTEES, REPRESENTATIONS OR WARRANTIES OF DURABILITY, FITNESS FOR A PARTICULAR
PURPOSE OR USE, MERCHANTABILITY, MERCHANTABLE QUALITY, NON-INFRINGEMENT, SATISFACTORY QUALITY, OR TITLE, OR ARISING
FROM A STATUTE OR CUSTOM OR A COURSE OF DEALING OR USAGE OF TRADE, OR RELATED TO THE DOCUMENTATION OR ITS USE,
OR PERFORMANCE OR NON-PERFORMANCE OF ANY SOFTWARE, HARDWARE, SERVICE, OR ANY THIRD PARTY PRODUCTS AND
SERVICES REFERENCED HEREIN, ARE HEREBY EXCLUDED. YOU MAY ALSO HAVE OTHER RIGHTS THAT VARY BY STATE OR PROVINCE.
SOME JURISDICTIONS MAY NOT ALLOW THE EXCLUSION OR LIMITATION OF IMPLIED WARRANTIES AND CONDITIONS. TO THE EXTENT
PERMITTED BY LAW, ANY IMPLIED WARRANTIES OR CONDITIONS RELATING TO THE DOCUMENTATION TO THE EXTENT THEY CANNOT
BE EXCLUDED AS SET OUT ABOVE, BUT CAN BE LIMITED, ARE HEREBY LIMITED TO NINETY (90) DAYS FROM THE DATE YOU FIRST
ACQUIRED THE DOCUMENTATION OR THE ITEM THAT IS THE SUBJECT OF THE CLAIM.

TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW IN YOUR JURISDICTION, IN NO EVENT SHALL RIM BE LIABLE FOR ANY TYPE
OF DAMAGES RELATED TO THIS DOCUMENTATION OR ITS USE, OR PERFORMANCE OR NON-PERFORMANCE OF ANY SOFTWARE,
HARDWARE, SERVICE, OR ANY THIRD PARTY PRODUCTS AND SERVICES REFERENCED HEREIN INCLUDING WITHOUT LIMITATION ANY
OF THE FOLLOWING DAMAGES: DIRECT, CONSEQUENTIAL, EXEMPLARY, INCIDENTAL, INDIRECT, SPECIAL, PUNITIVE, OR AGGRAVATED
DAMAGES, DAMAGES FOR LOSS OF PROFITS OR REVENUES, FAILURE TO REALIZE ANY EXPECTED SAVINGS, BUSINESS INTERRUPTION,
LOSS OF BUSINESS INFORMATION, LOSS OF BUSINESS OPPORTUNITY, OR CORRUPTION OR LOSS OF DATA, FAILURES TO TRANSMIT OR
RECEIVE ANY DATA, PROBLEMS ASSOCIATED WITH ANY APPLICATIONS USED IN CONJUNCTION WITH RIM PRODUCTS OR SERVICES,
DOWNTIME COSTS, LOSS OF THE USE OF RIM PRODUCTS OR SERVICES OR ANY PORTION THEREOF OR OF ANY AIRTIME SERVICES,
COST OF SUBSTITUTE GOODS, COSTS OF COVER, FACILITIES OR SERVICES, COST OF CAPITAL, OR OTHER SIMILAR PECUNIARY LOSSES,
WHETHER OR NOT SUCH DAMAGES WERE FORESEEN OR UNFORESEEN, AND EVEN IF RIM HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.

TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW IN YOUR JURISDICTION, RIM SHALL HAVE NO OTHER OBLIGATION, DUTY,
OR LIABILITY WHATSOEVER IN CONTRACT, TORT, OR OTHERWISE TO YOU INCLUDING ANY LIABILITY FOR NEGLIGENCE OR STRICT
LIABILITY.

THE LIMITATIONS, EXCLUSIONS, AND DISCLAIMERS HEREIN SHALL APPLY: (A) IRRESPECTIVE OF THE NATURE OF THE CAUSE OF
ACTION, DEMAND, OR ACTION BY YOU INCLUDING BUT NOT LIMITED TO BREACH OF CONTRACT, NEGLIGENCE, TORT, STRICT LIABILITY
OR ANY OTHER LEGAL THEORY AND SHALL SURVIVE A FUNDAMENTAL BREACH OR BREACHES OR THE FAILURE OF THE ESSENTIAL
PURPOSE OF THIS AGREEMENT OR OF ANY REMEDY CONTAINED HEREIN; AND (B) TO RIM AND ITS AFFILIATED COMPANIES, THEIR
SUCCESSORS, ASSIGNS, AGENTS, SUPPLIERS (INCLUDING AIRTIME SERVICE PROVIDERS), AUTHORIZED RIM DISTRIBUTORS (ALSO
INCLUDING AIRTIME SERVICE PROVIDERS) AND THEIR RESPECTIVE DIRECTORS, EMPLOYEES, AND INDEPENDENT CONTRACTORS.

IN ADDITION TO THE LIMITATIONS AND EXCLUSIONS SET OUT ABOVE, IN NO EVENT SHALL ANY DIRECTOR, EMPLOYEE, AGENT,
DISTRIBUTOR, SUPPLIER, INDEPENDENT CONTRACTOR OF RIM OR ANY AFFILIATES OF RIM HAVE ANY LIABILITY ARISING FROM OR
RELATED TO THE DOCUMENTATION.

Prior to subscribing for, installing, or using any Third Party Products and Services, it is your responsibility to ensure that your airtime service
provider has agreed to support all of their features. Installation or use of Third Party Products and Services with RIM's products and services
may require one or more patent, trademark, copyright, or other licenses in order to avoid infringement or violation of third party rights. You are
solely responsible for determining whether to use Third Party Products and Services and if any third party licenses are required to do so. If
required you are responsible for acquiring them. You should not install or use Third Party Products and Services until all necessary licenses
have been acquired. Any Third Party Products and Services that are provided with RIM's products and services are provided as a convenience to
you and are provided "AS IS" with no express or implied conditions, endorsements, guarantees, representations, or warranties of any kind by
RIM and RIM assumes no liability whatsoever, in relation thereto. Your use of Third Party Products and Services shall be governed by and
subject to you agreeing to the terms of separate licenses and other agreements applicable thereto with third parties, except to the extent
expressly covered by a license or other agreement with RIM.

The terms of use of any RIM product or service are set out in a separate license or other agreement with RIM applicable thereto. NOTHING IN
THIS DOCUMENTATION IS INTENDED TO SUPERSEDE ANY EXPRESS WRITTEN AGREEMENTS OR WARRANTIES PROVIDED BY RIM FOR
PORTIONS OF ANY RIM PRODUCT OR SERVICE OTHER THAN THIS DOCUMENTATION.

Research In Motion Limited Research In Motion UK Limited


295 Phillip Street 200 Bath Road
Waterloo, ON N2L 3W8 Slough, Berkshire SL1 3XE
Canada United Kingdom

Published in Canada
Contents
1 BlackBerry JDE Plug-in for Eclipse.................................................................................................................... 5
Enable functionality similar to the BlackBerry Java Development Environment.................................... 5
Create an application for a specific version of the BlackBerry Device Software.................................... 5
Using a workspace for a BlackBerry Application......................................................................................... 6
Associate an Eclipse workspace with a workspace for a BlackBerry Application ........................... 6
Switch to a different workspace for a BlackBerry Application ............................................................7
Specify properties for a workspace for a BlackBerry Application.......................................................7
Specify build rules for a workspace for a BlackBerry Application ......................................................7
Delete a workspace for a BlackBerry Application from a workspace in Eclipse .............................. 8
Using a project for a BlackBerry Application ............................................................................................... 8
Create a project for a BlackBerry Application....................................................................................... 8
Add a project for a BlackBerry Application ........................................................................................... 9
Add a project for a BlackBerry Application from an existing BlackBerry JDE workspace.............. 9
Add a file to a project for a BlackBerry Application............................................................................. 9
Remove a file from a project for a BlackBerry Application ................................................................. 9
Specify general settings for a project for a BlackBerry Application.................................................10
Specify application settings for a project for a BlackBerry Application ..........................................10
Specify localization settings for a project for a BlackBerry Application...........................................11
Specify compiler settings for a project for a BlackBerry Application............................................... 12
Specify settings for how a project for a BlackBerry Application builds ...........................................13
Building a BlackBerry Application.................................................................................................................14
Using build configurations......................................................................................................................14
Associate a start configuration with a build configuration for a BlackBerry Application.............15
Using preprocessor directives ................................................................................................................16
Working with code signing protection.......................................................................................................... 17
Register to use BlackBerry protected APIs........................................................................................... 17
Request code signatures ......................................................................................................................... 17
Request a replacement registration key ...............................................................................................18
Run a BlackBerry Application that uses protected APIs.....................................................................18
Prevent a BlackBerry Application that runs on the BlackBerry Smartphone Simulator from ac-
cessing protected APIs ............................................................................................................................18
Use a code signing key to protect packages and classes ..................................................................19
View signature status for code signature requests .............................................................................19
Managing resources for localization.............................................................................................................19
Resource files a BlackBerry Application uses for localization ..........................................................20
Create a resource header or a resource content file for a BlackBerry Application.......................20
Determine if all resource keys in a resource collection are used in a project................................. 21
Find all .java files that use a resource key ............................................................................................ 21
Define an original locale ......................................................................................................................... 21
Mark a translation as correct or incorrect ............................................................................................ 21
Displaying unicode characters ..................................................................................................................... 22
Display unicode characters in the Java editor window ..................................................................... 22
Working with Icons ......................................................................................................................................... 22
Specify the position of a BlackBerry Application icon....................................................................... 22
Finding object leaks........................................................................................................................................ 22
View statistics to locate object leaks.................................................................................................... 22
Find an object leak .................................................................................................................................. 23
Display objects in memory to locate object leaks .............................................................................. 23
Optimizing code using the Profiler .............................................................................................................. 24
Specify Profiler options........................................................................................................................... 24
Generate Profiler data ............................................................................................................................ 25
View Profiler data .................................................................................................................................... 25
Save the contents of the Profiler pane to a .csv file...........................................................................26
View Javadoc for items in resource files in a project for a BlackBerry Application ......................26
Configuring the BlackBerry Smartphone Simulator.................................................................................. 27
Specify a BlackBerry Smartphone Simulator for a specific BlackBerry smartphone type ........... 27
Add a BlackBerry Application to the BlackBerry Smartphone Simulator that is running............ 27
Debug a BlackBerry Application on a BlackBerry Smartphone Simulator that is running .......... 27
Specify general settings for the BlackBerry Smartphone Simulator ............................................... 27
Specify the appearance of the BlackBerry Smartphone Simulator ................................................. 28
Specify debugging preferences for the BlackBerry Smartphone Simulator...................................29
Specify how the BlackBerry Smartphone Simulator interacts with the network...........................29
Specify the ports the BlackBerry Smartphone Simulator uses.........................................................30
Specify how the BlackBerry Smartphone Simulator manages memory...........................................31
Set the BlackBerry Smartphone Simulator to erase data.................................................................. 32
Manually erase BlackBerry Smartphone Simulator data................................................................... 32
Specify advanced features for the BlackBerry Smartphone Simulator ........................................... 32
Debug an application on a BlackBerry Smartphone ................................................................................. 33
Set preferences for running a BlackBerry Application in debug mode........................................... 33
Set the next statement for a BlackBerry Application in debug mode ............................................. 34
Testing a BlackBerry Application with the BlackBerry Smartphone Simulator .................................... 34
Test a BlackBerry Application that uses an HTTP connection.......................................................... 34
Open a web site in the BlackBerry browser when the BlackBerry Smartphone Simulator starts....
35
Start a BlackBerry Application when the BlackBerry Smartphone Simulator starts..................... 35
Add a BlackBerry Application to the BlackBerry Smartphone Simulator .......................................36
Run a BlackBerry Application in the BlackBerry Smartphone Simulator .......................................36
View output from the BlackBerry Smartphone Simulator .................................................................36
Test a BlackBerry Application with the BlackBerry smartphone.............................................................36
Distributing a BlackBerry Application in a production environment...................................................... 37
Distribute a BlackBerry Application using the BlackBerry Desktop Manager............................... 37
Distributing a BlackBerry Application from a web page ................................................................... 37
Related resources............................................................................................................................................ 37
1
BlackBerry JDE Plug-in for Eclipse
You can use the BlackBerry® JDE Plug-In for Eclipse™ to develop, debug and test BlackBerry Applications from
within Eclipse™ and Eclipse-based IDEs. You can use the BlackBerry JDE Plug-in for Eclipse to develop
applications for BlackBerry devices. The BlackBerry JDE Plug-in for Eclipse contains a subset of the features and
components included in the BlackBerry® Java® Development Environment.

Enable functionality similar to the BlackBerry Java


Development Environment
1. Open the Eclipse™ workspace.
2. On the Window menu, click Preferences.
3. Expand the General item.
4. Select the Workspace item.
5. Select the Refresh automatically option.
6. Select the Save automatically before build option.

Create an application for a specific version of the BlackBerry


Device Software
1. In Eclipse™, on the Window menu, click Preferences.
2. Expand the BlackBerry JDE item.
3. Select Installed Components.
4. In the Component section, select an installed component from the drop-down list.
5. Navigate to the installation directory of the BlackBerry JDE Component Package or the BlackBerry® Java®
Development Environment.
6. Click OK until the Preferences window disappears.
BlackBerry JDE Plug-in for Eclipse online help

Using a workspace for a BlackBerry Application


A workspace for a BlackBerry® Application contains project files, including java source files, graphics, and other
resource files. An Eclipse™ workspace can be associated with only a single workspace for a BlackBerry
Application.

Associate an Eclipse workspace with a workspace for a BlackBerry Application


In an Eclipse™ workspace that has never contained a project for a BlackBerry® Application, when you import or
create a project for a BlackBerry Application, the BlackBerry® JDE Plug-in for Eclipse™ creates a workspace for a
BlackBerry Application in the Eclipse workspace. The project for a BlackBerry Application is now associated with a
workspace for a BlackBerry Application. When you import or create additional projects in the Eclipse workspace,
the BlackBerry JDE Plug-in for Eclipse associates the additional projects with the workspace for a BlackBerry
Application.
1. Make sure the current Eclipse workspace is not associated with a workspace for a BlackBerry Application.
2. Perform one of the following tasks:

Task Steps
Create a project for a BlackBerry 1. On the File menu, click New > Project.
Application in an Eclipse 2. Expand the BlackBerry folder.
workspace.
3. Select BlackBerry project.
4. Click Next.
5. In the Project name field, type a name.
6. Click Next.
7. Click Finish.
Import a project for a BlackBerry 1. On the File menu, click Import.
Application into an Eclipse 2. Expand the BlackBerry folder.
workspace.
3. Select Existing BlackBerry Projects into Workspace.
4. Click Next.
5. In the Select BlackBerry files field, click Browse.
6. Select a BlackBerry project file.
7. Click Open.
8. Click Next.
9. Click Finish.

6
1: BlackBerry JDE Plug-in for Eclipse

Task Steps
Import a workspace for a BlackBerry 1. On the File menu, click Import.
Application into an Eclipse 2. Expand the BlackBerry folder.
workspace.
3. Select Existing BlackBerry Projects into Workspace.
4. Click Next.
5. Beside the Import projects field, click Browse.
6. Select a BlackBerry workspace file.
7. Click Open.
8. Select the BlackBerry workspace files to import.
9. Click Finish.

Switch to a different workspace for a BlackBerry Application


1. On the File menu, click Switch Workspace.
2. Select the workspace in Eclipse™ that is associated with the workspace for the BlackBerry® Application.

Specify properties for a workspace for a BlackBerry Application


1. In the Package explorer view, select a workspace.
2. On the BlackBerry menu, select Configure BlackBerry Workspace.
3. Click the General tab.
4. Perform any of the following actions:

Task Steps
Specify a project version to apply to all projects in the workspace. > Type a project version in the Project Version Override
field.
Specify a project vendor to apply to all projects in the workspace. > Type a vendor name in the Project Vendor Override field.
Compress resources to save space. > Select Compress resources if significant space gain.
Specify preprocessor directives > Under Preprocessor defines, click Add.
Delete preprocessor directives > Under Preprocessor defines, select a directive and click
Delete.
Edit preprocessor directives > Under Preprocessor defines, select a directive and click
Edit.

For more information on directives, see “Using preprocessor directives” on page 16.
5. Click OK.

Specify build rules for a workspace for a BlackBerry Application


1. In the Project Explorer, select a workspace.
2. On the BlackBerry menu, select Configure BlackBerry Workspace.

7
BlackBerry JDE Plug-in for Eclipse online help

3. Click the Build Rules tab.


4. Perform one of the following actions:

Task Steps
Add a build rule. 1. Click Add.
2. In the File Extension field, type a file extension.
3. In the Target File Extension field, type a file extension.
4. In the Build Rule field, type a build rule, for example, copy $srcfile $dstfile.
5. Click OK.
Delete a build rule. 1. In the Implicit build rule field, select a build rule.
2. Click Delete.
Edit a build rule. 1. In the Implicit build rule field, select a build rule.
2. Click Edit.
3. Perform one or more of the following actions:
• In the File Extension field, change the file extension.
• In the Target File Extension field, change the file extension.
• In the Build Rule field, change the build rule.
4. Click OK.

Delete a workspace for a BlackBerry Application from a workspace in Eclipse


1. In the Package explorer view, select a workspace.
2. Right-click the workspace and select Delete.
3. In the Delete Resources dialog box, select Delete project contents on disk if you want to delete the files from
your hard drive as well.
4. Click OK.

Using a project for a BlackBerry Application


You cannot modify a project through both the BlackBerry® Java® Development Environment and the BlackBerry®
JDE Plug-in for Eclipse™ simultaneously. If you make changes to the project through the BlackBerry JDE, when you
refresh the project in the BlackBerry JDE Plug-in for Eclipse, the project will lose its dependencies.
If you wish to make modifications to the project using the BlackBerry JDE, close the BlackBerry JDE Plug-in for
Eclipse, make the modifications in the BlackBerry JDE, and close the BlackBerry JDE before opening Eclipse again.

Create a project for a BlackBerry Application


1. On the File menu, click New > BlackBerry Project.
2. In the Project name field, type a name for the project.
3. Click Next.

8
1: BlackBerry JDE Plug-in for Eclipse

4. Click Finish.

Add a project for a BlackBerry Application


1. On the File menu, click Import.
2. In the Import dialog box, expand the BlackBerry folder.
3. Select Existing BlackBerry Projects into Workspace.
4. Click Next.
5. In the Import projects field, browse to a BlackBerry JDE project file.
6. Click Open.
7. Select the files you want to import.
8. Click Finish.

Add a project for a BlackBerry Application from an existing BlackBerry JDE


workspace
1. On the File menu, click Import.
2. In the Import dialog box, expand the BlackBerry folder.
3. Select Existing BlackBerry Projects into Workspace.
4. Click Next.
5. In the Import projects field, browse to a BlackBerry JDE project file.
6. Click Open.
7. Select the files you want to import.
8. Click Finish.

Add a file to a project for a BlackBerry Application


1. In the Navigator view, select a BlackBerry® project.
2. Right-click the project and select Import.
3. In the Import dialog box, select a source location.
4. Browse to the location and select the files to add.
5. Click Finish.

Remove a file from a project for a BlackBerry Application


1. In the Navigator view, select a file in a BlackBerry® project.
2. Right-click the file and select Delete.

9
BlackBerry JDE Plug-in for Eclipse online help

3. Click OK.

Specify general settings for a project for a BlackBerry Application


1. In the Navigator view, select a BlackBerry® project.
2. Right-click the project and select Properties.
3. In the Properties for pane, select BlackBerry Project Properties.
4. Click the General tab.
5. Specify any of the following settings:

Setting Description
Title Type a descriptive name for the project.
To create a keyboard shortcut for an application, add the Unicode underscore character (\u0332) after
a letter in the title. For example, for the Hello World application, type H\u0332ello World. When the
user presses the h key on the BlackBerry smartphone Home screen, the Hello World application starts.
If more than one application uses the same keyboard shortcut, the application that appears first on the
Home screen starts.
Version Type the version number of the project.
Vendor Type the name of the company that owns the project.
Description Type a description for the project.
Always make project active Select this option to make the project always active.
Excluded from “Build All” Select this option to prevent the project from being built when you click Build All on the Project menu.

6. Click Apply.
7. Click OK.

Specify application settings for a project for a BlackBerry Application


1. In the Navigator view, select a BlackBerry® project.
2. Right-click the project and select Properties.
3. In the Properties for pane, select BlackBerry Project Properties.
4. Click the Application tab.
5. Specify any of the following settings:

Setting Description
Project type In the Project type drop-down list, select one of the following
options:
• CLDC Application: an application that uses CLDC/MIDP and
BlackBerry APIs
• MIDlet: an application that uses MIDP APIs only
• Library: a library on which other applications can depend on.

10
1: BlackBerry JDE Plug-in for Eclipse

Setting Description
Alternate entry point for In the drop-down list, click another project in the workspace that this
project invokes.
Note: This field is available only if the project type is Alternate CLDC
Application Entry Point.
Name of main MIDlet class Type the name of the class that extends
javax.microedition.midlet.MIDlet.
Note: This field is available only if the Project type is MIDlet or
Alternate MIDlet Entry Point.
Arguments passed to “static public void main(String args[])” Specify arguments to pass into the application main() method.
Note: This field is available only if the project type is ECMAScript,
CLDC Application, or Alternate CLDC Application Entry Point.
Home screen position (0 if no preference) To set the position of the application icon on the Home screen, type a
number from 1 to 255, where 1 is highest priority and 255 is lowest
priority.
Note: This field is not available if the Project type is Library.
System module Select this option to run the application in the background, without
displaying an icon on the BlackBerry smartphone Home screen.
This field is not available if the Project type is Library.
Auto-run on startup Select this option to start the application automatically when the
BlackBerry device starts.
This option is not available if the Project type is MIDlet.
Note: Auto-run applications must be digitally signed by RIM to run on
BlackBerry smartphones.
Startup tier If the Auto-run on startup option is selected, select a startup tier to
determine the priority with which the application is started, in
relation to other applications.
For third-party applications, you can select 6 or 7 (other start-up tiers
are reserved for BlackBerry Applications). If you do not specify a start-
up tier, the default tier is 7 (lowest priority).
Note: This option is not available if the Project type is MIDlet.

6. Click Apply.
7. Click OK.

Specify localization settings for a project for a BlackBerry Application


To support multiple languages, create resource files for localization, and then specify the options on the Resources
tab. The following steps requires localization resources to exist for an application. See the BlackBerry Java
Development Environment Development guide for information about localizing BlackBerry® Applications.
1. In the Navigator view, select a BlackBerry project.
2. Right-click the project and select Properties.
3. In the Properties for pane, select BlackBerry Project Properties.

11
BlackBerry JDE Plug-in for Eclipse online help

4. Click the Resources tab.


5. Specify any of the following settings:

Setting Description
Title Resource Available Select this option if the application's title and description have been internationalized in a resource
bundle.
Resource Bundle Select the resource header file to use for this application, such as HelloWorldRes.
Title Id Select the resource key to use for the application title, such as APPLICATION_TITLE. If you do not
provide a resource for the application title, the BlackBerry IDE uses the Title field on the General tab.
Description Id Select the resource key to use for the application description, such as APPLICATION_DESCRIPTION. If
you do not provide a resource for the application description, the BlackBerry IDE uses the Description
field on the General tab.
Icon files Select the image files to use for application icons.
Focus Icon files Select the image files to use for application icons in focus.

6. Click Apply.
7. Click OK.

Specify compiler settings for a project for a BlackBerry Application


1. In the Navigator view, select a BlackBerry® project.
2. Right-click the project and select Properties.
3. In the Properties for pane, select BlackBerry Project Properties.
4. Click the Compile tab.
5. Specify any of the following settings:

Setting Description
Output messages about what the compiler is doing Select this option to view detailed compiler information when you build
this project.
Note: Selecting this option is the same to setting the -verbose option for
rapc.
If you select this option, Eclipse™ will create many “rapc_XXXX.dir"
directories in the %TEMP% directory during compilation.
Generate no warnings Select this option to hide compiler warnings when you build this project.
Tip: Warnings do not prevent the project from being built successfully,
but they can indicate possible errors in your code.
Treat warnings as errors Select this option to stop compilation if warnings occur.
Output source locations where deprecated APIs are used Select this option to view the location of deprecated APIs in the source
files.
Don't convert image files to png Select this option to prevent image files from being converted to .png
format. Select this option if your application needs to access raw image
data on the BlackBerry smartphone.

12
1: BlackBerry JDE Plug-in for Eclipse

Setting Description
No warning for no exported static routine: .main(String[]) Select this option to prevent the compiler from issuing a warning if
main() is undefined.
Preprocessor defines Add, remove, or edit directives used by the preprocessor when processing
java files. For more information on directives, see “Using preprocessor
directives” on page 16.
Alias list To repackage existing API libraries into a new library project, list one or
more libraries that this project replaces, separated by a semi-colon (;).
For example, if you are creating a library project called “newlib” that
repackages existing libraries “libA” and “libB”, you can specify libA;libB
in this field so that .cod files that use those libraries continue to work
correctly.

6. Click Apply.
7. Click OK.

Specify settings for how a project for a BlackBerry Application builds


1. In the Navigator view, select a BlackBerry® project.
2. Right-click the project and select Properties.
3. In the Properties for pane, select BlackBerry Project Properties.
4. Click the Build tab.
5. Specify any of the following settings.

Setting Description
Output file name Specify the name of the .cod file that is output for the project. If this field is empty, the project name is used.
Pre build step Type a command that Eclipse™ runs before building the project.
You can use regular expressions. If you do not specify an absolute path, file locations are relative to the folder
in which this workspace is located.
Post build step Type a command that Eclipse™ runs after building the project.
You can use regular expressions. If you do not specify an absolute path, file locations are relative to the folder
in which the workspace is located.
Clean step Type a command that Eclipse™ runs when you click Clean or Clean All on the Build menu.
Imported alx files Click Add to add external .alx files that you want to build with your application. You can use this option to include
applications on which your project depends that are not in the current workspace. The .alx files that you add
here are included in <requires id> tags in the .alx file that is generated for your project.

6. Click Apply.
7. Click OK.

13
BlackBerry JDE Plug-in for Eclipse online help

Building a BlackBerry Application


Using build configurations
You can specify several build configurations for your projects. In each build configuration, you can choose which
projects are active.
You can use this functionality to create a set of active projects to build with a BlackBerry Application.

Build your application automatically


You can specify that your application build automatically, each time resources are modified. Each time you save
resources, an incremental build occurs.
> On the Project menu, select Build Automatically.

Create a build configuration


1. On the BlackBerry menu, select Build Configurations > Edit.
2. Click Add.
3. In the Enter the name field, type a name for the build configuration.
4. Click OK.
5. Click OK.

Remove a build configuration


1. On the BlackBerry menu, select Build Configurations > Edit.
2. In the Select window, select a build.
3. Click Remove.
4. Click OK.

Include a project in a build configuration


1. On the BlackBerry menu, select Build Configurations > Edit.
2. In the Edit Build Configurations dialog box, select a configuration.
3. Place a check mark beside the project(s) to include in the configuration.
4. Click OK.

Use a build configuration


> On the BlackBerry menu, select Build Configurations > buildName, where buildname represents the name of
a build.

Build the current build configuration


> From the Project menu, select Build Active BlackBerry Configuration.

14
1: BlackBerry JDE Plug-in for Eclipse

Add a source to a build configuration for a BlackBerry Application


1. Perform one of the following tasks:

Task Steps
To open the start configuration dialog box to > On the Run menu, click Run Configurations.
manage a run mode start configuration.
To open the start configuration dialog box to > On the Run menu, click Debug Configurations.
manage a debug mode start configuration.

2. Perform one of the following tasks:


• To work with an existing start configuration, under BlackBerry Simulator, select a start configuration.
• To work with a new start configuration, right-click BlackBerry Simulator, select New.
3. Perform one of the following tasks:

Task Steps
To associate the start configuration with a debug > Click Debug.
build configuration.
To associate the start configuration with a private > Click Private.
build configuration.
To associate the start configuration with a release > Click Release.
build configuration.
To associate the start configuration with a custom > Click the name of the build configuration.
build configuration.

4. Click the Source tab.


5. Perform one of the following tasks:

Task Steps
To add a source to the start 1. Click Add.
configuration. 2. In the Add source dialog box, select the type of source to add to the source lookup path.
3. Press OK.
4. Find and select the source.
To remove a source from the 1. In the Source Lookup Path field, select a source.
start configuration. 2. Click Remove.

Associate a start configuration with a build configuration for a BlackBerry


Application
1. On the Run menu, select Run Configurations.
2. Perform one of the following actions
• To work with an existing start configuration, under BlackBerry Simulator, select a start configuration.
• To work with a new start configuration, right-click BlackBerry Simulator, select New.

15
BlackBerry JDE Plug-in for Eclipse online help

3. Perform one of the following tasks:

Task Steps
To associate the start configuration with a debug > Click Debug.
build configuration.
To associate the start configuration with a private > Click Private.
build configuration.
To associate the start configuration with a release > Click Release.
build configuration.
To associate the start configuration with a custom > Click the name of the build configuration.
build configuration.

4. Click the Simulator tab.


5. In the Profile drop-down list, click a non-Default BlackBerry® Smartphone Simulator.
6. On each tab, configure settings for the BlackBerry Smartphone Simulator. see “Configuring the BlackBerry
Smartphone Simulator” on page 27.
7. Click Run.

Using preprocessor directives


You can specify a number of preprocessor directives that are used for preprocessing your source before it is passed
to the compiler. You must enable preprocessing in the IDE before you can specify preprocessor directives.

Directive Description
//#preprocess This directive specifies that a file must be preprocessed.
//#ifdef tag ... #else ... #endif This directive specifies that the block before the else is compiled if tag is specified.
Otherwise, only the block after the else is compiled.
//#ifndef tag ... #else ... #endif This directive specifies that the block before the else is compiled if tag is not
specified. Otherwise, only the block after the else is compiled.

16
1: BlackBerry JDE Plug-in for Eclipse

Working with code signing protection


Register to use BlackBerry protected APIs
1. Complete the registration form at https://www.blackberry.com/JDEKeys.
2. Save the .csi file that Research In Motion® sends to you in an email message. The .csi file contains a list of
signatures and your registration information.
If the BlackBerry® Signing Authority Tool administrator does not provide you with the .csi file or the Client PIN
and you are an ISV partner, contact your ISV Technical Partnership Manager. If you are not an ISV partner,
send an email message to jde@rim.com.
3. To start the BlackBerry Signing Authority Tool, double-click the .csi file.
4. If a dialog box appears that states that a private key cannot be found, follow the instructions to create a new
key pair file.
5. In the Registration PIN field, type the PIN that RIM provided.
6. In the Private Key Password field, type a password of at least eight characters. The private key password
protects your private key. If you lose this password, you must register again with RIM. If this password is
stolen, contact RIM immediately.
7. Click Register.
8. Click Exit.

Restricted access to code signatures


The BlackBerry® Signing Authority Tool administrator might place restrictions on your .csi file to limit your access
to code signatures. To request changes to these restrictions, contact your administrator.

.csi file restriction Description


# of Requests Specifies the maximum number of requests you can make using a particular .csi file. When you reach the maximum
number of requests, the .csi file becomes not valid. To make new code signature requests, you must apply for a new .csi
file.
Although an administrator can permit an infinite number of requests, a maximum number of requests is often specified
for security reasons.
Expiry Date Specifies the expiry date for your .csi file. After the expiry date, you can no longer apply for code signatures with this
.csi file. To make new signature requests, you must apply for a new .csi file.

Request code signatures


To perform this task, you must obtain a .csi file from Research In Motion®. For more information about obtaining a
.csi file from RIM®, see “Register to use BlackBerry protected APIs on page 13.
1. In Eclipse™, open the projects that require code signatures.
2. On the BlackBerry menu, select Request signatures.
3. Select the .cod files for the project.

17
BlackBerry JDE Plug-in for Eclipse online help

4. In the Signature Tool dialog box, click Request.


5. Type your private key password.
6. Click OK. The BlackBerry® Signing Authority Tool uses the private key password to append the signature to
the request, and it sends the signature list of .cod files to the Web Signer application for verification. The Web
Signer application installs when you install the BlackBerry Signing Authority Tool. See the BlackBerry Signing
Authority Tool Version 1.0 - Password Based Administrator Guide for more information about the Web Signer
application.

Request a replacement registration key


Your registration key and .csk file are stored together. If you lose the registration key or the .csk file, you cannot
request code signatures.
• If you are an ISV partner and lose the .csk file, contact your ISV Technical Partnership Manager.
• If you are not an ISV partner, send an email message to jde@rim.com.

Run a BlackBerry Application that uses protected APIs


The BlackBerry® JDE Plug-in for Eclipse™ might display error messages in the Java® editor window if the
BlackBerry Application attempts to access RIM® protected APIs (BlackBerry Apps APIs, RIM Crypto APIs, and RIM
Runtime APIs). The error messages appear in the application code wherever a reference exists to a protected API.
You must configure the BlackBerry JDE Plug-in for Eclipse to allow an application to access RIM protected APIs.
To run a BlackBerry Application that uses RIM controlled APIs on a BlackBerry device, you must first obtain code
signing permission from RIM. Visit http://na.blackberry.com/eng/developers/downloads/api.jsp for more
information about code signing and to register with RIM to use protected APIs.
1. On the Window menu, select Preferences.
2. Select BlackBerry JDE > Code Signing.
3. Select one or more of the following keys:
• RIM BlackBerry Apps API
• RIM Crypto API
• RIM Runtime API
4. Click OK.

Prevent a BlackBerry Application that runs on the BlackBerry Smartphone


Simulator from accessing protected APIs
The BlackBerry® Smartphone Simulator must be in secure mode to prevent an application that runs on the
BlackBerry Smartphone Simulator from accessing protected APIs.
1. On the Run menu, click Debug Configurations or Run Configurations.
2. Select BlackBerry Simulator.

18
1: BlackBerry JDE Plug-in for Eclipse

3. Select an existing start configuration for a BlackBerry Smartphone Simulator, or create a new one.
4. Click the Simulator tab.
5. Click the General tab.
6. Click Enable device security.
7. Click Run.

Use a code signing key to protect packages and classes


1. After you receive the internal key, the external key, or both keys from RIM®, start Eclipse™.
2. Open the project that contains the packages or classes that you want to control access to.
3. In the Navigator view, double-click a .key file.
4. Select one or more of the following options:

Option Description
Use as default for public Specify the .key file as the .key file that is used to protect all public classes.
classes
Use as default for non-public Specify the .key file as the .key file that is used to protect all non-public classes.
classes

5. Find the name of the package that contains packages and classes that you will protect with the .key file.
6. Expand the package contents.
7. Select each element that requires access control.
8. Click Ok.

View signature status for code signature requests


1. Start Eclipse™.
2. On the BlackBerry menu, select Request signatures.
3. Select a .cod file.
4. View the Status column:
• For files the Web Signer has signed, the Status column displays Signed.
• For files the Web Signer did not sign, the Status column displays Failed. The Web Signer might have
rejected the .cod file because the private key password was typed incorrectly.

Managing resources for localization


You can use the BlackBerry® JDE Plug-in for Eclipse™ to localize text strings without changing application code.

19
BlackBerry JDE Plug-in for Eclipse online help

A ResourceBundle object stores information and resources for a locale. A ResourceBundleFamily object
contains a collection of ResourceBundle objects. An application can use a ResourceBundleFamily object to
display information in a language that is specific to the locale of the BlackBerry device user.
When you compile a BlackBerry Application, the BlackBerry JDE Plug-in for Eclipse compiles each
ResourceBundle object that you include with the application into a separate code (.cod) file. You can load the
appropriate .cod files onto a BlackBerry device along with other files the application requires.
See the BlackBerry Java Development Environment Fundamentals Guide for more information about managing
resources for localization.

Resource files a BlackBerry Application uses for localization


For each BlackBerry® device application, you create the following files:

File Description Example


Resource header file This file defines descriptive keys for each localized string. AppName.rrh
During compilation, the BlackBerry® JDE Plug-in for Eclipse automatically
creates a resource interface using the same name as the .rrh file with
Resource appended.
Resource content file (root locale) This file maps numeric keys to string literals for the root (global) locale. AppName.rrc
Resource content file (specific locales) This file maps descriptive keys to values for the global and specific locales AppName_en.rrc
(language and country).
Files must have the same name as the resource header file, followed by an
underscore (_) and the language code, and then optionally a single
underscore (_) and country code. For example, AppName_en_GB.rrc.
Two-letter language and country codes are specified in ISO-639 and ISO-
3166, respectively.
Initialization file Initializes the resource bundle mechanism. init.java
Note: This file is no longer required.

Create a resource header or a resource content file for a BlackBerry


Application
When you create a new .rrh header file, the BlackBerry® JDE Plug-in for Eclipse™ creates the associated .rrc
resource content file.
If you create an .rrc file and an existing .rrh file exists for it, the BlackBerry JDE Plug-in for Eclipse creates only the
new .rrc file.
If you create an .rrc file and an .rrh file does not exist for it, the BlackBerry JDE Plug-in for Eclipse creates the .rrc
file and the .rrh file.
1. On the File menu, click New > Other.
2. In the New window, expand the BlackBerry item.
3. Select BlackBerry Resource File.
4. Click Next.

20
1: BlackBerry JDE Plug-in for Eclipse

5. In the New BlackBerry Resource File dialog box, select the project folder for the BlackBerry Application.
6. In the File name field, type the name of the .rrc or .rrh file.
7. Click Finish.

Determine if all resource keys in a resource collection are used in a project


1. In the Package Explorer view, double-click an .rrh file.
2. In the Resource Editor window, click Validate. If one or more resource keys are not found, an message
displays indicating the resource keys that are not present.

Find all .java files that use a resource key


1. In the Package Explorer view, double-click an .rrh file.
2. In the Resource Editor window, right-click a key and select Find Key. If the key was found, the system outputs
a list of all Java® files that reference the key and the line numbers in the Java files where the key is referenced.

Define an original locale


The BlackBerry® JDE Plug-in for Eclipse™ provides versioning support for creating resources in different
languages. You can make changes to resource values in their native language, or original locale. Translators can
identify language resources that have changed and that require translation. The original locale contains resource
values in the developer's native language. Developers should identify an original locale for each resource header
(.rrh) file.
1. In the Package Explorer view, double-click an .rrh file.
2. In the Resource Editor window, click Options.
3. In the Resource Editor Options window, select Use versioning highlighting from given resource.
4. In the drop-down field, select a locale, for example, select en.

Mark a translation as correct or incorrect


1. In the Package Explorer view, double-click an .rrh file.
2. In the Resource Editor window, right-click a key.
3. Perform one of the following actions:
• To mark a translation as correct, select Mark Translation Correct.
• To mark a translation as incorrect, select Mark Translation InCorrect.

21
BlackBerry JDE Plug-in for Eclipse online help

Displaying unicode characters


Display unicode characters in the Java editor window
> Install the Arial Unicode MS font on the computer.

Working with Icons


Specify the position of a BlackBerry Application icon
1. In the Navigator view, select a BlackBerry® project.
2. Right-click the project and select Properties.
3. In the Properties for pane, select BlackBerry Project Properties.
4. Click the Application tab.
5. In the Home screen position field, type a number from 1 to 255, where 1 is highest priority and 255 is lowest
priority.

Finding object leaks


Object leaks can cause the BlackBerry® Java® Virtual Machine to run out of flash memory, and the BlackBerry
Smartphone to reset.

View statistics to locate object leaks


Use the Memory Statistics tool with the Objects tool to find object leaks. The Memory Statistics tool retrieves
information on your application's memory usage and identifies the number of objects in memory. The Objects tool
displays detailed information for each object.
1. On the Window menu, click Show View > Other.
2. Expand the BlackBerry folder.
3. Select BlackBerry Memory Statistics View.
4. Click OK.
The Memory Statistics pane has the following columns and rows.

Column Description
# objects number of objects that are currently in memory
Bytes in use amount of memory that is used by objects
Allocated total memory that is allocated to the Java Virtual Machine
Free memory that is available

22
1: BlackBerry JDE Plug-in for Eclipse

Row Description
Object handles number of object handles in memory
RAM RAM usage
Flash sum of the other three rows
Transient objects (flash) number of transient objects in flash memory
Persistent objects (flash) number of persistent objects in flash memory
Code modules (flash) number of code modules in flash memory

Find an object leak


1. Specify two or more breakpoints in your code.
2. On the Run menu, click Debug As > BlackBerry Simulator Application. The application runs to the first
breakpoint.
3. On the Window menu, click Show View > Other.
4. Expand the BlackBerry folder.
5. Select BlackBerry Memory Statistics View.
6. Click OK
7. In the main window, on the View menu, click Memory Statistics.
8. Click Refresh.
9. Click Snapshot.
10. Press F8 to resume running of the application. The application runs to the second breakpoint.
11. Click Refresh.
12. Click Compare.
13. Repeat steps 1 through 10, setting breakpoints closer together until they converge on the object leak.

Display objects in memory to locate object leaks


1. On the Run menu, click Debug As > BlackBerry Simulator Application. The application runs to the first
breakpoint.
2. In the Debug view, click Suspend.
3. On the Window menu, click Show View > Other.
4. Expand the BlackBerry folder.
5. Select BlackBerry Objects View.
6. Click OK
7. Click Garbage collect.
8. Click Snapshot.

23
BlackBerry JDE Plug-in for Eclipse online help

9. Press F8 to resume running of the program.


10. Perform operations in the application that do not increase the number of reachable objects. For example,
create a new contact and then delete it.
11. In the Debug view, click Suspend.
12. Click Garbage collect.
13. Click Compare.
The objects pane displays the number of objects that have been deleted and added since the previous
snapshot. If the number of objects added is not the same as the number of objects deleted, you might have an
object leak.
14. To identify new objects, use the Type, Process, and Location filter types available through the Filter drop-
down list at the top of the objects pane.
15. To save the contents of the objects pane to a comma separated values (.csv) file, click Save.

Optimizing code using the Profiler


The Profiler displays the percentage of time spent in each code area to the current point of execution.

Note: To improve the reliability of results when you run the profiler application, exit other Microsoft® Windows® applications.

Specify Profiler options


1. On the Window menu, click Show View > Other.
2. Expand the BlackBerry folder.
3. Select BlackBerry Profiler View.
4. Click OK.
5. In the profile pane, click Options.
6. Specify the following options:

Drop-down list Option Description


Method attribution Cumulative The Profiler calculates the time spent executing bytecode in a
method and all methods invoked by that method.
In method only The Profiler calculates the time spent executing bytecode in that
method only. The timer stops when a call is made to another
method.

24
1: BlackBerry JDE Plug-in for Eclipse

Drop-down list Option Description


What to profile Time (clock ticks) The Profiler considers execution time (measured in clock ticks).
Number of objects created The Profiler considers the number of objects created.
Size of objects created The Profiler considers the size of objects created.
Number of objects committed The Profiler considers the number of committed objects.
Size of objects committed The Profiler considers the size of committed objects.
Number of objects moved to RAM The Profiler considers the number of objects moved into memory.
Size of objects moved to RAM The Profiler considers the size of objects moved into memory.
User Counting The Profiler considers user counting.

Generate Profiler data


1. Specify a breakpoint at the beginning and end of the section you want to profile.
2. On the Run menu, click Debug As > BlackBerry Simulator Application.
3. In the BlackBerry® Smartphone Simulator, run the application. The debugging tool pauses the application
when it reaches the first breakpoint.
4. On the Window menu, click Show View > Other.
5. Expand the BlackBerry folder.
6. Select BlackBerry Profiler View.
7. Click OK.
8. In the profile pane, click Options.
9. Select the type of method attribution, a sorting method, and the type of information to profile.
10. Click OK.
11. On the Run menu, click Debug As > BlackBerry Simulator Application.
12. In the BlackBerry Smartphone Simulator, run the application. The debugging tool pauses the application
when it reaches the second breakpoint.
13. If the profile pane is not visible, on the Window menu, click Show View > Other, expand the BlackBerry folder,
select BlackBerry Profiler View.
14. On the File menu, click Refresh. Profile data is retrieved from the BlackBerry JVM. Profiler data is not cleared,
so running a program again adds to the data.
• Use profile views to view information about the section of code that you just ran.
15. On the File menu, click Save to save the contents of the profile pane to a comma separated values (.csv) file.

View Profiler data


The profile pane has three views. Each view displays details about an item of execution (such as a method), the
percentage of time spent running the item, and the number of times the item was run.
1. On the Window menu, click Show View > Other.

25
BlackBerry JDE Plug-in for Eclipse online help

2. Expand the BlackBerry folder.


3. Select BlackBerry Profiler View.
4. Click OK.
5. Click one of the following view tabs:

View Description
Summary The Summary view displays general statistics about the system and the garbage collector.
It displays the percentage of time that the Java VM has spent idle, executing code, and performing quick and full
garbage collection. The Percent column displays the percent of total JVM running time, including idle and
collection time.
Method The Method view displays a list of modules, sorted either by the information that you are profiling or by the number
of times each item has been executed.
In this view, the Percent column displays the percentage of JVM execution time only, not including idle and garbage
collection time.
Source The Source view displays the source lines of a single method. You can navigate through the methods that call, and
are called by, that method.
You can expand a source line to show individual bytecode.
You can further expand any bytecode that corresponds to a method invocation to show the target(s) of the method
invasion.

Save the contents of the Profiler pane to a .csv file


1. In the Profile pane, on the File menu, click Save.
2. Select a location and type a name for the file.
3. Click Save.
The contents of the pane are saved to a comma-separated values (.csv) file. Contents are saved in the same
way as as they are displayed.

View Javadoc for items in resource files in a project for a BlackBerry


Application
1. On the Window menu, click Show View > Javadoc.
2. Place the cursor on an item in the resource file.

26
1: BlackBerry JDE Plug-in for Eclipse

Configuring the BlackBerry Smartphone Simulator


Specify a BlackBerry Smartphone Simulator for a specific BlackBerry
smartphone type
To perform the following steps, you must first create a new BlackBerry® Smartphone Simulator profile or choose a
non-default profile from the Profile drop-down list. You can test a BlackBerry Application on different simulated
BlackBerry smartphone types to verify that the BlackBerry Application functions optimally on each applicable
type.
1. On the Run menu, click Debug Configurations or Run Configurations.
2. Perform one of the following tasks:
• To work with an existing start configuration, under BlackBerry Simulator, select a start configuration.
• To work with a new start configuration, right-click BlackBerry Simulator, select New.
3. Click the Simulator tab.
4. Click the General tab.
5. Select a BlackBerry® Smartphone Simulator profile from the Profile drop-down list, or create a new profile.

Add a BlackBerry Application to the BlackBerry Smartphone Simulator that is


running
> Verify that the BlackBerry® Application is active in the build configuration that you associate with the start
configuration for the application.

Debug a BlackBerry Application on a BlackBerry Smartphone Simulator that is


running
1. On the Run menu, click Debug Configurations.
2. Select Running BlackBerry Simulator.
3. Select New Launch Configuration.
4. In the Name field, specify a name.
5. Press Debug.

Specify general settings for the BlackBerry Smartphone Simulator


To perform the following steps, you must first create a new BlackBerry® Smartphone Simulator profile or choose a
non-default profile from the Profile drop-down list.
1. On the Run menu, click Debug Configurations or Run Configurations.
2. Perform one of the following tasks:

27
BlackBerry JDE Plug-in for Eclipse online help

• To work with an existing start configuration, under BlackBerry Simulator, select a start configuration.
• To work with a new start configuration, right-click BlackBerry Simulator, select New.
3. Click the Simulator tab.
4. Click the General tab.
5. Select one or more of the following options:

Option Description
Launch simulator when debugging tool connects start the BlackBerry Smartphone Simulator when you start the debug process.
Minimize when launching simulator Minimize the BlackBerry Smartphone Simulator when you start it.
Launch Mobile Data Service (MDS) with simulator Start the BlackBerry MDS simulator when you start the BlackBerry Smartphone
Simulator. With the BlackBerry MDS Simulator you can test network
applications, push applications, and browser applications.
Launch app or URL on start up Specify an application to start or a URL to display when the JVM starts.
Device Specify the model number of the BlackBerry Smartphone Simulator that starts
when you run an application.
Automatically use default values for all prompts Specify all dialog boxes to automatically select a default choice.
PIN Specify the PIN of the BlackBerry Smartphone Simulator.
ESN Specify the Electronic Serial Number of the BlackBerry Smartphone Simulator.
If unspecified, the number is generated from the PIN.
Enable device security Specify the BlackBerry Smartphone Simulator to simulate a secure BlackBerry
smartphone.
System locale Specify the locale of the BlackBerry Smartphone Simulator.
Keypad locale Specify the locale of the keypad of the BlackBerry Smartphone Simulator. The
default value is "en".
Do not save settings Specify that the BlackBerry Smartphone Simulator does not save changes to its
UI and dialog boxes when it closes.

Specify the appearance of the BlackBerry Smartphone Simulator


To perform the following steps, you must first create a new BlackBerry® Smartphone Simulator profile or choose a
non-default profile from the Profile drop-down list.
1. On the Run menu, click Debug Configurations or Run Configurations.
2. Perform one of the following tasks:
• To work with an existing start configuration, under BlackBerry Simulator, select a start configuration.
• To work with a new start configuration, right-click BlackBerry Simulator, select New.
3. Click the Simulator tab.
4. Click the View tab.
5. Select one or more of the following options:

Option Description
Disable automatic backlight shutoff Specify that the backlighting of the BlackBerry® Smartphone Simulator remains turned on.

28
1: BlackBerry JDE Plug-in for Eclipse

Option Description
Hide network-specific information Specify that the BlackBerry Smartphone Simulator does not display network information.
Display the LCD only Specify that the BlackBerry Smartphone Simulator only displays the LCD screen.
Full or relative path to a Config-Pack Specify the path to a BlackBerry Smartphone Simulator configuration.
LCD height (pixels) Specify that the BlackBerry Smartphone Simulator displays the LCD screen using a specified
height, in pixels.
LCD zoom Specify that the BlackBerry Smartphone Simulator displays the LCD screen using a specific
zoom level.
Always keep LCD backlight on Specify that the LCD backlight stays on after the idle timeout period.
Do not show help for key mappings Specify that help for key mappings is not displayed.

Specify debugging preferences for the BlackBerry Smartphone Simulator


To perform the following steps, you must first create a new BlackBerry® Smartphone Simulator profile or choose a
non-default profile from the Profile drop-down list.
1. On the Run menu, click Debug Configurations or Run Configurations.
2. Perform one of the following tasks:
• To work with an existing start configuration, under BlackBerry Simulator, select a start configuration.
• To work with a new start configuration, right-click BlackBerry Simulator, select New.
3. Click the Debugging tab.
4. Select one or more of the following options:

Option Description
Interrupt the debugger tool on Stop program execution if the JVM detects a thread deadlock.
potential deadlock
Do not stop execution when an Continue program execution when an exception is caught by a catch(Throwable th)
exception is caught by “catch( block.
Throwable )”

Specify how the BlackBerry Smartphone Simulator interacts with the network
To perform the following steps, you must first create a new BlackBerry® Smartphone Simulator profile or choose a
non-default profile from the Profile drop-down list.
1. On the Run menu, click Debug Configurations or Run Configurations.
2. Perform one of the following tasks:
• To work with an existing start configuration, under BlackBerry Simulator, select a start configuration.
• To work with a new start configuration, right-click BlackBerry Simulator, select New.
3. Click the Simulator tab.
4. Click the Network tab.

29
BlackBerry JDE Plug-in for Eclipse online help

5. Specify any of the following options:

Option Description
Disable registration Prevent the BlackBerry Smartphone Simulator from registering with the network.
Network Specify a string describing one of the available networks. Use the following format:
“{param}:value;{param}:value".
Start with radio off Start the BlackBerry Smartphone Simulator with the wireless transceiver off.
Phone number Specify the phone number of the BlackBerry Smartphone Simulator.
Automatically answer outgoing calls Specify that the BlackBerry Smartphone Simulator automatically answers outgoing calls.
IMEI Specify the International Mobile Equipment Identity (IMEI).
ICCID (GPRS) Specify the 19 or 20-digit serial number of the simulated SIM card.
IMSI (GPRS) Specify a 15-digit number to designate the subscriber.
Simulate SIM not present Specify that the BlackBerry Smartphone Simulator reports the SIM card as missing.
IP Address For a computer with multiple network interfaces, explicitly select the interface that the
BlackBerry Smartphone Simulator uses for network operations.
Ignore UDP port conflicts Suppress warnings that the BlackBerry Smartphone Simulator produces when it is unable to
bind to a selected port.
SMS source port Specify the UDP port that the BlackBerry Smartphone Simulator uses to receive SMS text
messages.
SMS destination port Specify the UDP port that the BlackBerry Smartphone Simulator uses to send SMS text
messages.
PDE port Specify the PDE port that the BlackBerry Smartphone Simulator uses for GPS access. This
setting is for CDMA devices only.

Specify the ports the BlackBerry Smartphone Simulator uses


To perform the following steps, you must first create a new BlackBerry® Smartphone Simulator profile or choose a
non-default profile from the Profile drop-down list.
1. On the Run menu, click Debug Configurations or Run Configurations.
2. Perform one of the following tasks:
• To work with an existing start configuration, under BlackBerry Simulator, select a start configuration.
• To work with a new start configuration, right-click BlackBerry Simulator, select New.
3. Click the Simulator tab.
4. Click the Ports tab.
5. Specify any of the following options:

Option Description
USB cable connected Simulate the BlackBerry Smartphone Simulator as connected to the USB port of a computer.
Bluetooth test board port Specify the port number that a Bluetooth text board is connected to.

30
1: BlackBerry JDE Plug-in for Eclipse

Specify how the BlackBerry Smartphone Simulator manages memory


To perform the following steps, you must first create a new BlackBerry® Smartphone Simulator profile or choose a
non-default profile from the Profile drop-down list.
1. On the Run menu, click Debug Configurations or Run Configurations.
2. Perform one of the following tasks:
• To work with an existing start configuration, under BlackBerry Simulator, select a start configuration.
• To work with a new start configuration, right-click BlackBerry Simulator, select New.
3. Click the Simulator tab.
4. Click the Memory tab.
5. Specify any of the following options:

Option Description
Application heap size (in bytes) Specify the size of RAM on a BlackBerry Smartphone Simulator that the JVM can use for all
memory allocation. By default, the BlackBerry Smartphone Simulator sets a size based on the
BlackBerry Smartphone Simulator type.
Branding data Specify the data that the BlackBerry Smartphone Simulator uses for the branding sector of the
BlackBerry Smartphone Simulator flash memory.
Reset the filesystem on startup Specify that the BlackBerry Smartphone Simulator erases filesystem data when it starts.
Reset NVRAM on startup Specify that the BlackBerry Smartphone Simulator erases system non-volatile storage data
when it starts.
Filesystem size (bytes) Specify the size of simulated flash memory that the BlackBerry Smartphone Simulator uses as
the filesystem. The BlackBerry Smartphone Simulator uses a specific size depending on the
BlackBerry Smartphone Simulator type.
Do not save flash data on simulator exit Specify that the BlackBerry Smartphone Simulator does not save changes to flash memory
when it closes.
Do not compact filesystem on exit Specify that the BlackBerry Smartphone Simulator does not compact filesystem data when it
closes.
Simulate no SD Card inserted Specify that the BlackBerry Smartphone Simulator does not create files that represent SD
Card data.
Create new SD Card image Specify that the BlackBerry Smartphone Simulator creates a new SD Card file instead of using
an existing SD Card file.
SD Card size Specify the size for new SD Cards that a BlackBerry Smartphone Simulator uses. The default
size is 32 MB.
SD Card image Specify that the BlackBerry Smartphone Simulator uses an existing SD Card data file as the
SD Card.
Use PC filesystem for SD Card files Specify that the BlackBerry Smartphone Simulator uses a directory on the computers hard
drive as the SD Card.
PC filesystem path for SD Card files Specify the root directory location of the SD Card file that the BlackBerry Smartphone
Simulator uses. The BlackBerry Smartphone Simulator uses this location when the "Use PC
filesystem for SD Card files" option is set. The default path is working directory/sdcard).

31
BlackBerry JDE Plug-in for Eclipse online help

Set the BlackBerry Smartphone Simulator to erase data


To perform the following steps, you must first create a new BlackBerry® Smartphone Simulator profile or choose a
non-default profile from the Profile drop-down list.
1. On the Run menu, click Debug Configurations or Run Configurations.
2. Perform one of the following tasks:
• To work with an existing start configuration, under BlackBerry Simulator, select a start configuration.
• To work with a new start configuration, right-click BlackBerry Simulator, select New.
3. Click the Simulator tab.
4. From the Profile drop-down list, select a non-default BlackBerry Smartphone Simulator profile, or create a new
profile.
5. Click the Memory tab.
6. Select one or more of the following options:

Task Steps
To erase all files. > Select Erase All.
To erase files that represent SD Card data. > Select Do not save flash data on simulator exit.
To erase system non-volatile storage data > Select Reset NVRAM on startup.
when the BlackBerry Device Simulator
starts.
To erase file system data when the > Select Reset the filesystem on startup.
BlackBerry Device Simulator starts.

Manually erase BlackBerry Smartphone Simulator data


> Perform one of the following actions:

Task Steps
To erase file system data. > On the BlackBerry menu, click Erase Simulator File > Erase File System.
To erase system non-volatile storage data. > On the BlackBerry menu, click Erase Simulator File > Erase Non-volatile Storage.
To erase files that represent SD Card data. > On the BlackBerry menu, click Erase Simulator File > Erase Removable Memory.

Specify advanced features for the BlackBerry Smartphone Simulator


To perform the following steps, you must first create a new BlackBerry® Smartphone Simulator profile or choose a
non-default profile from the Profile drop-down list.
1. On the Run menu, click Debug Configurations or Run Configurations.
2. Perform one of the following tasks:
• To work with an existing start configuration, under BlackBerry Simulator, select a start configuration.
• To work with a new start configuration, right-click BlackBerry Simulator, select New.

32
1: BlackBerry JDE Plug-in for Eclipse

3. Click the Simulator tab.


4. Click the Advanced tab.
5. Specify any of the following options:

Option Description
Command Line Specify the command line options for starting the BlackBerry Smartphone Simulator.
Working Directory Specify the directory that the BlackBerry Smartphone Simulator writes files to. The BlackBerry
Smartphone Simulator writes files such as flash memory files and SD Card files to this
directory.
User application Specify the path to the Jvm.dll file.
Do not simulate using an authentic Specify that the BlackBerry Smartphone Simulator identifies the battery as a third-party
BlackBerry battery battery.
Do not use PC numpad as trackball Specify that the BlackBerry Smartphone Simulator does not use the PC numeric keypad to
simulate the trackball.

Debug an application on a BlackBerry Smartphone


To perform the following steps, you must first create a new BlackBerry® Smartphone Simulator profile or choose a
non-default profile from the Profile drop-down list.
1. Connect the BlackBerry® smartphone to the USB port on your computer.
2. Open the BlackBerry Device Manager.
3. Load the application to the BlackBerry smartphone.
4. In Eclipse™, on the Run menu, click Debug Configurations.
5. Select BlackBerry Device.
6. Click New.
7. In the Name field, specify a name.
8. In the Attach to device field, select a BlackBerry smartphone.
9. Click Debug.

Set preferences for running a BlackBerry Application in debug mode


To perform the following steps, you must first create a new BlackBerry® Smartphone Simulator profile or choose a
non-default profile from the Profile drop-down list.
1. On the Windows menu, click Preferences.
2. Expand BlackBerry > JDE > Debug.
3. Set debug properties.
4. Click Apply.
5. Click OK.

33
BlackBerry JDE Plug-in for Eclipse online help

JavaLoader [-u] [-pport] [-bbps] [-wpassword] load file

Parameter Description
port Specify aBlackBerry smartphone PIN if the BlackBerry smartphone connects to a USB port. You must also specify
the usb option.
password This parameter specifies the password for the BlackBerry smartphone, if a password for the BlackBerry
smartphone is set.
file This parameter specifies one or more .cod files to load onto the BlackBerry smartphone.

Set the next statement for a BlackBerry Application in debug mode


To perform the following steps, you must first create a new BlackBerry® Smartphone Simulator profile or choose a
non-default profile from the Profile drop-down list. You can only set the next statement at a breakpoint.
1. In Eclipse™, in the Editor view, in a source file, set one or more breakpoints.
2. On the Run menu, click Debug As > BlackBerry Simulator.
3. In the Editor view, right-click a source file.
4. Select Set Next Statement.

Testing a BlackBerry Application with the BlackBerry


Smartphone Simulator
Test a BlackBerry Application that uses an HTTP connection
To test applications that use HTTP connections, use the BlackBerry® MDS Simulator. To get the BlackBerry Email
and MDS Services Simulator package, visit www.na.blackberry.com/eng/developers.

Start the BlackBerry MDS Simulator when you start the BlackBerry Smartphone Simulator
1. On the Run menu, click Debug Configurations or Run Configurations.
2. Perform one of the following tasks:
• To work with an existing start configuration, under BlackBerry Simulator, select a start configuration.
• To work with a new start configuration, right-click BlackBerry Simulator, select New.
3. Click the Simulator tab.
4. Click the General tab.
5. Select the Launch Mobile Data System Connection Service (MDS-CS) with simulator option.
6. Click OK.

Change to a different version of the BlackBerry MDS Simulator


By default, the BlackBerry® JDE Plug-in for Eclipse™ uses the BlackBerry® MDS Simulator located in
C:\Program Files\Eclipse\plugins\net.rim.eide.componentpackx.x.x_x.x.x.x\MDS.

34
1: BlackBerry JDE Plug-in for Eclipse

1. On the Window menu, click Preferences > BlackBerry JDE > MDS Simulator.
2. Click Browse.
3. Navigate to the BlackBerry MDS Simulator installation directory.
4. Select the MDS folder.
5. Click OK.

Open a web site in the BlackBerry browser when the BlackBerry Smartphone
Simulator starts
The following steps require the BlackBerry® MDS simulator. To obtain the BlackBerry MDS simulator, download
the BlackBerry Email and MDS Services Simulator package from the BlackBerry developer site: http://
na.blackberry.com/eng/developers.
1. On the Run menu, click Debug Configurations or Run Configurations.
2. Perform one of the following tasks:
• To work with an existing start configuration, under BlackBerry Simulator, select a start configuration.
• To work with a new start configuration, right-click BlackBerry Simulator, select New.
3. Click the Simulator tab.
4. Click the General tab.
5. Select the Launch Mobile Data System Connection Service (MDS-CS) with simulator option.
6. In the Launch app or URL on startup field, typing the web site URL.
7. Click OK.

Start a BlackBerry Application when the BlackBerry Smartphone Simulator


starts
1. In the Navigator view, select a BlackBerry® project.
2. Right-click the project and select Properties.
3. In the Properties for pane, select BlackBerry Project Properties.
4. Click the Build tab.
5. In the Output file name field, type the name of the .cod file of the application.
6. Click Apply.
7. Click OK.
8. On the Run menu, click Debug Configurations or Run Configurations.
9. Perform one of the following tasks:
• To work with an existing start configuration, under BlackBerry Simulator, select a start configuration.

35
BlackBerry JDE Plug-in for Eclipse online help

• To work with a new start configuration, right-click BlackBerry Simulator, select New.
10. Click the Simulator tab.
11. Click the General tab.
12. In the Launch app or URL on startup field, type the name of the .cod file of the application.
13. Click OK.

Add a BlackBerry Application to the BlackBerry Smartphone Simulator


1. Start the BlackBerry® Smartphone Simulator.
2. On the BlackBerry Smartphone Simulator, on the File menu, click Load Java Program.
3. Browse to and select the .cod file for an application.
4. Click Open. An icon for the application appears on the Home Screen.

Run a BlackBerry Application in the BlackBerry Smartphone Simulator


On the Home screen, the BlackBerry® Smartphone Simulator displays icons for all applications that it has
installed. When you select an icon, its application title appears at the bottom of the screen.
1. In the Navigator pane, select a project.
2. On the Run menu, click Run As > BlackBerry Simulator Application.
3. In the BlackBerry Smartphone Simulator window, click an application icon.
4. Click the trackwheel or trackball.
5. Click a menu item.
6. Click Close.

View output from the BlackBerry Smartphone Simulator


1. On the Window menu, click Show View > General > Console.
2. In the toolbar, select Open Console.
3. Select BlackBerry Simulator Output Console.
4. Click OK.

Test a BlackBerry Application with the BlackBerry


smartphone
You can use a command line tool called Javaloader.exe to install and remove a BlackBerry® Application on a
BlackBerry smartphone using the USB port without using descriptor files or web pages. Javaloader.exe can be
useful when you install or remove a BlackBerry Application frequently during testing and development.

36
1: BlackBerry JDE Plug-in for Eclipse

1. Connect the BlackBerry Smartphone to the computer.


2. At a command prompt, switch to the following directory:
C:\Program Files\Eclipse\plugins\net.rim.eide.componentpackx.x.x_x.x.x.x\bin
3. Type javaloader to view the syntax of the tool.

Distributing a BlackBerry Application in a production


environment
Distribute a BlackBerry Application using the BlackBerry Desktop Manager
In the BlackBerry® Desktop Manager, you can use the Application Loader tool to allow BlackBerry smartphone
users to download BlackBerry Applications onto their computers and install them on their BlackBerry
smartphones. For more information about using .alx files and the BlackBerry Desktop Manager to distribute a
BlackBerry Application, see the BlackBerry Java Development Environment Developer Guide.
1. In the Navigator view, select the project file for a BlackBerry Application.
2. Right-click the project and select Generate ALX file.
3. Distribute the .alx file and the .cod files for the BlackBerry Application to BlackBerry smartphone users.

Distributing a BlackBerry Application from a web page


You can use the BlackBerry® Application Web Loader to allow BlackBerry smartphone users to install a BlackBerry
Application from a web page.
When BlackBerry smartphone users use Microsoft® Internet Explorer® to visit the web page, they are asked to
connect their BlackBerry smartphone to the USB port on their computer. The BlackBerry Application installs using
an ActiveX® Control. For more information about using the BlackBerry Application Web Loader, see the BlackBerry
Application Web Loader Developer Guide.

Related resources
For more information about RIM APIs, see the API Reference for the BlackBerry® Java Development Environment.
For more information about how to create and test applications for the BlackBerry smartphone, including
technical updates, FAQs, and developer discussion forums, visit www.na.blackberry.com/eng/developers/.

37
BlackBerry JDE Plug-in for Eclipse online help

38
©2008 Research In Motion Limited
Published in Canada.

You might also like