BlackBerry Java Connectivity
Developer Articles
Setup & Basics
The SDK for BlackBerry allows you to implement a scanner interface directly into your BlackBerry application. The SDK includes the ALX and COD files as well as a simple demo application to make scanner integration into your application faster and easier. This article deals with installing the BlackBerry development environment and deploying your BlackBerry application. The BlackBerry SDK uses the Microvision XSP Communications Protocol. Features of XSP include: XML-based data packets, support for a number of legacy protocols, added data integrity through CRCs, uniform data format using serial and Bluetooth connections, etc.
The SDK for BlackBerry includes an ALX file and a COD file. The .ALX file (Application loader file) is used by the Application Loader tool in the BlackBerry Desktop Software to load applications to the handheld. The .COD file is a standard (native) compiled and packaged application code file that executes on the BlackBerry device.
Installing JDE
Before you can develop BlackBerry applications you must download and install the RIM Java Development Environment (JDE). Download the latest version of the JDE and the RIM API from:
http://na.blackberry.com/eng/developers/downloads/jde.jsp
http://www.blackberry.com/developers/downloads/jde/api.shtml
The JDE includes the RIM Integrated Development Environment (IDE) and the handheld simulator (Fledge.exe). Use the IDE to develop Java applications for BlackBerry Wireless devices. Using the JDE requires:
- Java 1.5 (5.0) or higher installed on development system.
- <bin> directory of the Java 2 SDK must be in the system PATH variable (see below).
You can connect the JDE debugger to an actual handheld using a serial or USB port. When using a serial port you must install the Java Communications API (v2.0) from http://java.sun.com/products/javacomm/. This API is not required if the handheld is connected to a USB port.
Setting the Path Variable
When installing the BlackBerry IDE you must set the system PATH variable to include the <bin> directory of the Java 2 SDK must be in the system PATH variable. To set or change the PATH variable:
1. Right-click My Computer, and then click Properties.
2. Click the Advanced tab and then click Environment variables.
3. Click one the following options, for either a user or a system variable:
- Click New to add a new variable name and value.
- Click an existing variable, and then click Edit to change its name or value.
- Click an existing variable, and then click Delete to remove it.
Loading Applications
When developing applications you can use either the DesktopManager or the JavaLoader to load your application onto the BlackBerry device. Both of these methods work well and it is a matter of preference as to which one you use.
JavaLoader forces the .COD file to be loaded regardless of the application version and build number. If you are prototyping or making lots of changes then this might be advantageous to you. Many developers prefer using JavaLoader during the development process.
The Desktop Manager will not load an application if the BlackBerry contains a newer version. With the Desktop Manager you must be sure to update the version and build number to insure that the application is the latest version. This is an extra step in the application development cycle. However, this extra step forces you update the version and build number and provides more rigor in the development cycle.
Some developers prefer the ease of the JavaLoader method while others prefer the added version control and accountability of the Desktop Manager method. As a developer you must choose which method works best in your environment.
Additional Resources and References
www.blackberry.com/developers
http://java.sun.com/javase/downloads/index.jsp
http://blackberryforums.pinstack.com/3311-blackberry_os_software_links_carrier.html
www.blackberry.com/knowledgecenterpublic/livelink.exe?func=ll&objId=739500&objAction=browse&sort=name
