Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

Eclipse Java ME (J2ME) Developer Guide
Previous Page Home Next Page

Launch a MIDlet in debug mode

In this section, you will learn more about debugging Java ME MIDlets in the workbench.

The following is assumed:

  • You configured the Java debugging options
  • You are familiar with debugging your Java programs in Eclipse.

If you did not configured the Java debugging options, please see the PreparingEclipse section of this User Guide.

Using the "Debug As" context menu item

  1. In the Package Explorer view, find the main MIDlet class and double-click it to open it in the java editor.
  2. Place your cursor on the vertical ruler along the left edge of the editor area on the class constructor and double-click on the ruler to set a breakpoint.

    Adding a breakpoint

  3. Right click on the main MIDlet class in the Package Explorer and select Debug As > Emulated Java ME MIDlet. This will launch the selected class in debug mode using the Java ME SDK device previously configured for use in the MIDlet project. The Debug As context menu item is also available in other places, such as the Outline view and the Java editor.

    Contextual launch in debug mode

  4. A configuration is automatically created to launch the MIDlet in debug mode.

    Contextual launch in debug mode
  5. The program will run until the breakpoint is reached. When the breakpoint is hit, execution is suspended, and you are asked whether to open the Debug perspective. Click Yes and start debugging.

Using the Debug button from the workbench toolbar

  1. Add at least one breakpoint to your classes.
  2. Click on the debug button from the workbench toolbar, which will launch the currently selected resource or active editor in debug mode.


  3. If prompted, select the Emulated Java ME MIDlet option.




  4. A configuration is automatically created to launch the MIDlet in debug mode.
  5. The program will run until the breakpoint is reached. When the breakpoint is hit, execution is suspended, and you are asked whether to open the Debug perspective. Click Yes and start debugging.

Through the Application Descriptor overview page

  1. Add at least one breakpoint to your classes.
  2. In the Package Explorer view, find the Application Descriptor file and double-click it to open it in the java editor.

  3. On the Debugging section, click on the Launch as emulated Java ME MIDlet in Debug mode.

  4. A configuration is automatically created to launch the MIDlet in debug mode.
  5. The program will run until the breakpoint is reached. When the breakpoint is hit, execution is suspended, and you are asked whether to open the Debug perspective. Click Yes and start debugging.

Manually creating the configuration to launch the MIDlet in debug mode

    href="eclipse_java_me_javascript:executeCommand("org.eclipse.debug.ui.commands.OpenDebugConfigurations")"> Opens the Debug Launch Configurations dialog Run > Open Debug Dialog... from the workbench menu bar.  This opens a dialog that lets you create, modify, and delete launch configurations of different types.
  1. Select Wireless Toolkit Emulation in the left hand list of launch configuration types, and press the New button in the toolbar. This will create a new launch configuration for your MIDlet Project. The tabs on the right hand side allow you control specific aspects of the launch.

    Device Management preference page

By default, the configuration is created for Over The Air debugging. See here for more details on the different launch modes.

Debugging Signed MIDlets

Under normal circumstances, when you select a non-OTA launch, MTJ attempts to run the emulator using the classes in the verified area, rather than performing a full deployment. Certain emulators will not operate in this mode, and require your project to be fully deployed. In addition, OTA launches also require a full deployment operation be performed.

MTJ handles all these details automatically. However, as a result, if you have configured your MIDlet to be signed, the signature operation is part of the deployment process. As such, depending on your signature password settings, MTJ may need to prompt you for the keystore and key passwords as part of doing the launch. This is most likely to happen the first time you attempt to launch when you have configured MTJ to prompt for passwords. Thereafter, until you close Eclipse or change the workspace, MTJ will store the passwords in memory, and thus will not have to re-prompt you.



 
 
  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire