Troubleshooting guide
246
BlackBerry Java Development Environment Development Guide
Testing applications using BlackBerry devices
After testing your application on the BlackBerry® device simulator, load your application on a live BlackBerry
device. When the application loads, you can open and test its functionality and performance. For debugging
purposes, attach your BlackBerry device to the BlackBerry Integrated Development Environment debugger to step
through your application code. This can be useful if you are trying to identify a network issue, a Bluetooth®
wireless technology issue, or other items that are difficult to simulate accurately.
If your application uses signed APIs, you might require code signing keys. See the BlackBerry Java Development
Environment Fundamentals Guide
for more information about code signing keys.
Connect the BlackBerry IDE to a BlackBerry device
1. Connect a BlackBerry® device to the computer.
2. Open the BlackBerry Integrated Development Environment.
3. Connect the BlackBerry IDE to the BlackBerry device:
• To connect a BlackBerry device that uses a USB port, click Debug > Attach to > Handheld > USB<PIN>,
where
PIN is the PIN of a BlackBerry device that is connected to the computer.
• To connect a BlackBerry device that uses a serial port, click Debug > Attach to > Handheld > COM <n>,
where
n is the serial port that your BlackBerry device connects to. To make this connection, you must
install the Java™ Communications API Version 2.0, which is available at http://java.sun.com/products/
javacomm/. You do not need this API if you connect the BlackBerry device through a USB port.
Debugging applications
When you connect a BlackBerry® device to a computer to perform testing and optimization of code, run
applications on the BlackBerry device and use the BlackBerry Integrated Development Environment debug tools.
Use breakpoints
In the breakpoints pane, perform any of the following tasks:
Task Steps
Execute code and print values to
the Output window when code
execution reaches a Breakpoint.
>In the Execute when hit field, type an expression. For example, type System.out.println(foo).
Open the source code at a set
breakpoint.
>In the Resume if true field, type an expression. When application execution reaches the breakpoint,
application execution resumes if the expression evaluates to true.
Stop the application after a
specific number of iterations
through a breakpoint.
>In the Iteration field, type a positive integer. When you start debugging, execution stops when the
number of iterations through a breakpoint equals the number you typed.
Stop the application when a
condition is true.
>In the Condition field, type a Boolean expression, such as x==100. The Hits field calculates the number
of times the application stops at a breakpoint when the Condition is true or the Condition field is empty.