Debugging the BlackBerry Device Application

Debug your device application by setting breakpoints and stepping through code.

  1. From the BlackBerry JDE, select Debug > Go to build and execute the application, and launch the simulator.
    You can view build results in the JDE output window.
  2. Add breakpoints to the code:
    1. Place your cursor in the code where you want to add a breakpoint and select Debug > Breakpoint > Set Breakpoint at Cursor.
    2. You can also set breakpoints for a given event from the same menu, for example, On startup, When an exception is thrown, Before garbage collection, and so on.
  3. Run the application from the simulator. The application stops based upon the breakpoint you set.
  4. Once stopped, you can step through the code using any of the step icons (step over, step into, step out, and so on) located in the JDE toolbar:

    For more information about the various views available for debugging, including determining memory usage, code coverage, and so on, refer to the BlackBerry JDE documentation. To view a video on how to debug your BlackBerry device application in the BlackBerry JDE, go to the Research In Motion Developer Video Library Web site at: http://supportforums.blackberry.com/t5/Java-Development/tkb-p/java_dev%40tkb?labels=video.