Applet Debugging

Applet debugging is typically achieved by one of two means: use the Sun Java appletviewer, available with the JDK, or use a Java-enabled web browser. Before continuing with this document, be sure to read the remote debugging help file within JSwat to learn the basics of connecting the debugger to a running JVM.

Applet Viewer

Start the applet viewer using a command line like the following:

appletviewer -J-Xdebug -J-Djava.compiler=NONE -J-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5000 <applet.html>

This will start the appletviewer with the JPDA debugger back-end and run the applet referenced in the given HTML file. The socket transport will be used and the back-end will act as the server, listening for a connection on port 5000.

Once you have started JSwat and the debuggee applet is running, use the remote attach functionality in JSwat to connect to the debugger back-end through port 5000. JSwat should clearly indicate that it attached successfully.

Web Browser

These instructions apply to web browsers that have the Sun Java plugin installed. This is typically Internet Explorer, although Netscape Navigator 6 and 7 will work as well. The plugin from Sun provides a control panel interface in Microsoft Windows, which makes configuring the plugin JVM easy.

With the web browser and the Java plugin installed, find the Java Plug-in control panel and change the Java Parameters to include the following:

-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5000

The 'address' value is necessary, otherwise you will not know which port to connect JSwat to. Then start the web browser and open the Java applet as usual. Start JSwat and use the remote attach functionality to connect to port 5000. JSwat should clearly indicate that it attached successfully.