Microsoft, ActiveX, Internet Explorer, and Windows are trademarks of Microsoft Corporation. Sun, and Java are trademarks of Sun
Microsystems, Inc. .
The BlackBerry smartphone and other devices and/or associated software are protected by copyright, international treaties, and various
patents, includin g one or m ore of the fo llowing U.S. patents: 6,278,442; 6, 271,605; 6,219,694; 6,075,470; 6,073,318; D 445,428; D433,460;
D416,256. Other patents are registered or pending in the U.S. and in various countries around the world. Visit
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.
All other trademarks are the properties of their respective owners.
www.rim.com/patents for a list of
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
295 Phillip Street
Waterloo, ON N2L 3W8
Canada
Published in Canada
Research In Motion UK Limited
200 Bath Road
Slough, Berkshire SL1 3XE
United Kingdom
Contents
1Tools for creating a BlackBerry device application ........................................................................................ 7
Using the BlackBerry Java Development Environment................................................................................7
Prerequisites for using the BlackBerry Java Development Environment...........................................7
Using the BlackBerry JDE Plug-in for Eclipse ...............................................................................................7
Prerequisites for using the BlackBerry JDE Plug-in for Eclipse..........................................................8
Development tools............................................................................................................................................8
The BlackBerry Smartphone Simulator ..................................................................................................9
The BlackBerry MDS simulator................................................................................................................ 9
The BlackBerry email server simulator..................................................................................................10
2Creating a BlackBerry device application....................................................................................................... 11
Create a basic BlackBerry device application ..............................................................................................11
Create a project for the HelloWorld application in an Eclipse workspace .......................................11
Set the information and type for the project for the HelloWorld application..................................11
Add .java source files to the project for the HelloWorld application................................................12
Import resources into HelloWorld.java..................................................................................................12
Provide a UI for a HelloWorld application ............................................................................................12
Allow the HelloWorld application start sending and receiving events when the application starts
12
Create a screen for the HelloWorld application ..................................................................................13
Allow the HelloWorld application display a screen.............................................................................14
Display a message when a BlackBerry smartphone user closes the HelloWorld application ......14
Test the HelloWorld application in the BlackBerry Smartphone Simulator ....................................14
Code sample: A HelloWorld application ...............................................................................................15
Create a BlackBerry device application with advanced UI features........................................................16
Create a project for a CityInfo application in an Eclipse workspace................................................16
Set the information and type for the project for the CityInfo application ......................................16
Add .java source files to the project for the CityInfo application .....................................................17
Import resources into CityInfo.java ....................................................................................................... 17
Provide a UI for the CityInfo application.............................................................................................. 17
Allow the CityInfo application start sending and receiving events when the application starts 17
Create a screen for the CityInfo application ........................................................................................18
Allow the CityInfo application use a screen that displays a drop-down list of city names...........18
Create a menu item that a BlackBerry smartphone user clicks to display more information about
a city they select.......................................................................................................................................18
Create a menu item that a BlackBerry smartphone user clicks to close a BlackBerry device appli-
Tools for creating a BlackBerry device
application
Using the BlackBerry Java Development Environment
Using the BlackBerry JDE Plug-in for Eclipse
Development tools
BlackBerry simulators
Using the BlackBerry Java Development Environment
You can use the BlackBerry® Java® Development Environment to create, test, and package BlackBerry device
applications for BlackBerry smartphones. The BlackBerry Java Development Environment is a Mobile Information
Device Profile (MIDP) and Connected Limited Device Configuration (CLDC) compliant J2ME environment
designed to provide a complete set of APIs and tools for you to develop a BlackBerry device application that runs
on BlackBerry smartphones. The BlackBerry Integrated Development Environment, included with the BlackBerry
JDE, lets you create a BlackBerry device application using CLDC 1.1 APSI, MIDP 2.0 APIs, and BlackBerry API
extensions that provide additional capabilities specific to BlackBerry smartphones.
Prerequisites for using the BlackBerry Java Development Environment
Your system must meet the following requirements to support the BlackBerry® Java® Development Environment:
•Microsoft® Vista™, Windows® 2000, or Windows XP
•Intel® Pentium® III processor or compatible (800 MHz or higher)
•512 MB RAM
•100 MB free hard disk space
•Java® SE Development Kit (JDK) Version 6 (download from the Sun Microsystems web site). The <bin>
directory of the Java SDK must be part of the system's PATH environment variable.
•DirectX 8.0 or greater (for the BlackBerry Smartphone Simulator)
Using the BlackBerry JDE Plug-in for Eclipse
You can use the BlackBerry® Java® Development Environment Plug-In for Eclipse™ to develop, debug and test
BlackBerry device applications from within Eclipse™ and Eclipse-based IDEs. You can use the BlackBerry® JDE
Plug-in for Eclipse™ to develop BlackBerry device applications for BlackBerry smartphones. The BlackBerry® JDE
Plug-in for Eclipse™ contains a subset of the features and components included in the BlackBerry Java
Development Environment.
Getting started guide
Prerequisites for using the BlackBerry JDE Plug-in for Eclipse
Verify that your system meets the following requirements:
•BlackBerry® Java® Development Environment Version 4.3.0 or later.
•BlackBerry® JDE Plug-in for Eclipse™ Version 1.0
•Eclipse™ Classic 3.4
•Microsoft® Windows Vista™, or Windows® XP
•Java® SE Development Kit (JDK) Version 6 (download from the Sun Microsystems web site). The <bin>
directory of the Java SDK must be part of the system's PATH environment variable.
•DirectX 8.0 or greater (for the BlackBerry Smartphone Simulator)
Development tools
The BlackBerry® Java® Development Environment (JDE) and BlackBerry® Java® Development Environment PlugIn for Eclipse™ include multiple tools that you can use to develop BlackBerry device applications. You can also
obtain these tools by downloading the BlackBerry Java Development Environment Component Package..
ToolDescription
RAPCUse the RAPC command prompt compiler to compile .java and .jar files into .cod files that you
can run in the BlackBerry Smartphone Simulator or load onto a BlackBerry smartphone. When
you invoke RAPC, use the "-import=" option to specify the net_rim_api.jar file as an input file.
For example, the following command prompt instruction compiles the SampleApp.jar file into a
.cod file of the same name:
JavaLoaderFrom a command prompt, use the JavaLoader tool to:
"Add, update, or remove a BlackBerry device aplication on a BlackBerry smartphone for testing
purposes. For production BlackBerry device applications, use the BlackBerry Desktop Software.
"View information about BlackBerry device application .cod files.
To run the JavaLoader tool, type a command with the following format:
Signature ToolUse the Signature Tool application to send code signature requests to the BlackBerry Signing
PreverifyUse the Preverify tool to partially verify your classes before loading your BlackBerry device
Authority Tool. Send code signature requests when your BlackBerry device application code
requires access to controlled APIs, classes, and methods.
application onto a BlackBerry smartphone. Completing this step will reduce the amount of
processing the smartphone must perform when you load your BlackBerry device application.
The Preverify tool receives a class path as input and produces new classes in an output directory
that you specify.
To run the Preverify tool, from the command prompt, type a command in the following format:
JDWPThe Java Debug Wire Protocol (JDWP) program lets you debug BlackBerry device applications
using third-party IDEs. The BlackBerry JDE Component Package includes the files that JDWP
requires to debug BlackBerry device applications:
• DefaultBuild.rc: a configuration file
• "FixedBuild.rc: a configuration file
• "Launcher.exe: a utility tool
• "focusFlipper.exe: a utility tool
• RimUsbJni.dll: a helper file that permits the JDWP program to communicate with a
BlackBerry smartphone through a USB port
BlackBerry simulators
The BlackBerry® Java® Development Environment (JDE) and the BlackBerry® Java® Development Environment
Plug-In for Eclipse™ include three different simulators you can use to create and test a BlackBerry device
application for a BlackBerry smartphone. See the
BlackBerry Smartphone Simulators.
The BlackBerry Smartphone Simulator
The BlackBerry® Smartphone simulator enables you to run BlackBerry device applications on your computer. The
BlackBerry Smartphone Simulator includes the BlackBerry device applications that are typically available on
BlackBerry smartphones and enables you to load and test your own BlackBerry device applications. You can
simulate and test various connectivity and state changes using the BlackBerry Smartphone Simulator. When you
use the BlackBerry Smartphone Simulator to perform testing, you might need to simulate additional BlackBerry
services. The BlackBerry MDS Simulator and the BlackBerry email server simulator are available for this purpose.
You can obtain BlackBerry Smartphone Simulators by downloading the BlackBerry® Java® Development
Environment, the BlackBerry® Java® Development Environment Plug-In for Eclipse™, or the BlackBerry® Java®
Development Environment Component Package from the BlackBerry Developer Zone web site at http://
www.blackberry.com/developers.
BlackBerry Simulator Guide for more information on how to use
The BlackBerry MDS simulator
The BlackBerry® MDS simulator is designed to simulate the BlackBerry MDS Connection Service component of
the BlackBerry Enterprise Server. Using the BlackBerry Smartphone Simulator with the BlackBerry MDS simulator
enables you to test network, push, and browser applications that are designed for use with a BlackBerry Enterprise
Server. If you are testing BlackBerry device applications that require an HTTP connection, you need the
BlackBerry Smartphone Simulator and the BlackBerry MDS simulator. You can obtain the BlackBerry MDS
simulator by downloading the BlackBerry® Java® Development Environment, the BlackBerry® Java® Development
Environment Plug-In for Eclipse™, or the BlackBerry Email and MDS Services Simulator Package from the
BlackBerry Developer Zone web site at http://www.blackberry.com/developers.
9
Getting started guide
The BlackBerry email server simulator
The BlackBerry® email server simulator is designed to send and receive messages between the BlackBerry
Smartphone Simulator and either a messaging application, such as Microsoft® Outlook®, or POP3 and SMTP
servers. You do not require a BlackBerry® Enterprise Server. You can obtain the BlackBerry email server simulator
by downloading the BlackBerry® Java® Development Environment, the BlackBerry® Java® Development
Environment Plug-In for Eclipse™, or the BlackBerry Email and MDS Services Simulator Package from the
BlackBerry Developer Zone web site at http://www.blackberry.com/developers.
10
Loading...
+ 22 hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.