Wiki

Clone wiki

javarosa / Debugging

Running Java Rosa with Debugging Support in Eclipse

TracNav(JavaRosaTOC)

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. In the "Emulation" tab, Select "Specific Device" and in the two following drop down menus ("Group" and "Device" respectively) choose "Sun Java(TM) Wireless Toolkit 2.5.2 for CLDC" and whatever device you're running with.
  6. 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.

Troubleshooting Debugging

JAD file doesn't exist

When running your phone's emulator you get:

''Xdescriptor: JAD file doesn't exist. Usage: emulator [-options] [Application]''

The solution (in the case of the Nokia S40 3ed fp2) is:

  • Launch the debug emulator once (this puts the launch in your eclipse action history). You'll probably get an error to do with the 'Jad' file not being found. If so, continue with the next steps:
  • Open your debug configuration
  • For the JAD URL you entered previously, remove "file:/" from the front of the URL.
  • Click 'Apply' to apply the changes. The 'debug' button will be greyed out.
  • Close the Debug Configurations window.
  • Select the arrow next to the bug /debugger icon at the top of eclipse and select the appropriate build target.
  • The Nokia Emulator should now find the correct JAD.

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.

Updated