Running Java Rosa with Debugging Support in Eclipse

Configure debugging environment in eclipse

  • Make sure you have installed WTK2.5.2 (when upgrading from 2.5.1, make sure to update the wtk.home property in the global.properties file in the J2ME-Polish directory). It does not appear to work with 2.5.1
  • Import devices under Preferences->J2ME->Device Management
  • Change default debug settings under Preferences->Java->Debug as specified here: http://www.eclipseme.org/docs/configuring.html#step4
  • Check out project from SVN and follow the normal configuration steps (http://code.dimagi.com/JavaRosa/wiki/GettingStarted).

Debugging support through JAD

  1. Run the ant target 'cleanbuildemulator', and close the emulator once it opens (I use this target because it turns off obfuscation; I'm sure the 'cleanbuild' target would suffice if you disabled obfuscation manually)
  2. Right-click the project -> "Debug As" -> "Open Debug Dialog". The "Create, Run, and Manage Configurations" screen should appear
  3. In the left pane, right-click the "Wireless Toolkit Emulator" node, select "New"
  4. In the "Midlet" tab of the new configuration, select "JAD URL", and browse to the .jad file for your project (eg. E:/Eclipse_Workspaces/JavaRosa/JavaProtocolSupport/dist/PolishedMobileMRSDemo.jad)
  5. Click "Debug"; the emulator should now respect your breakpoints

NOTE: if you RENAME the project (app.name in build.properties), you must UPDATE the .jad file in the debugging settings, or else you will continue to debug using the old .jar and get very very confused.

Old Issues

Debugging methods that don't seem to work (maybe they will work in the future)

  • J2ME Polish Mepose plugin
  • Native eclipse debugging ('Debug As' -> 'Ant Build')

Troubleshooting

The emulator may open, but the screen will be blank and no JavaRosa code will run. A few seconds later, execution will "finish successfully" and the emulator will close. It does not appear to crash.

Solution: configure the settings in Preferences->Java->Debug as described above.