| C H A P T E R 6 |
|
Debugging a MIDlet |
This chapter describes how to run a proxy and a debugger that use the K Virtual Machine (KVM) Debug Wireless Protocol (KDWP) so that you can debug a MIDlet. This chapter assumes that the MIDlet is packaged in a JAR file, and that the classes to be debugged are not ROMized.
1. Build the CLDC HotSpot
Implementation with the build-time option ENABLE_JAVA_DEBUGGER=true.
See the Build Guide for more information.
2. Build the Java Wireless Client software with the build-time option
USE_JAVA_DEBUGGER=true.
See the Build Guide for more information.
3. Ensure that your application is compiled with the -g option to javac, and preverify and package it as usual.
4. Install your application on the Java Wireless Client software using the installMidlet application.
See Using the OTA Installer for instructions on using the installMidlet application.
See your CLDC documentation for more information. For example:
$ java -classpath CLDC_DIST_DIR/bin/kdp.jar kdp.KVMDebugProxy -l 1234 -p -r localhost 2808
If you are starting the proxy on a different machine from your CLDC Hotspot Implementation, substitute the CLDC host's name for localhost.
6. Run the MIDlet that needs to be debugged.
See Running an Installed MIDlet for more information on running a MIDlet. For example:
$ ./runMidlet_g -port 2808 -debug 1
Note that the port for runMidlet is the same as the one given to the KDP proxy.
Use the -connect option to provide the location of the KDP proxy. For example:
$ jdb -connect com.sun.jdi.SocketAttach:hostname=localhost,port=1234
See your CLDC documentation for more information.
Copyright © 2007, Sun Microsystems, Inc. All rights reserved. SUN PROPRIETARY/CONFIDENTIAL.