Using the jswat debugger
NOTE: these instructions are geared toward Mac OSX.
Instructions for dowloading and installing
On the right side of the page, under the haeding "Featured dowloads",
In the directory where jswat-4.5-installer.jar resides,
java -jar jswat-4.5-installer.jar
from the command line.
This will walk you through several steps -- just click through them,
allowing all the default configution options to stand.
You can now run the debugger by executing
from the command line (where your-user-id) is the user ID
for your account on your machine.
As the above can get tedious, you may want to
do the following: in your home directory /Users/your-user-id,
create (or modify, if it already exists) the file .bashrc,
including the line
After restarting Terminal.app, you can now run jswat
by just typing jswat at the command line.
It may be more convenient to run it "in the background" by executing
from the command line.
jswat takes some time to master, but here is a "quickstart guide".
Getting started with jswat
Click on the Sessions -> New Session tab.
This brings up a window with several tabs.
Under the Attributes tab, select a name for the session (can be quite arbitrary).
Under the Classes tab, use the browser to select the directory containing your program.
Under the Sources tab, also use the browser to select the directory containing your program.
Click on the Window -> Sources tab -- this should open up a a window shouwing a
listing of files in your choses source directory (you may have to "click to expand").
In this source window, double click on the .java containing your program.
You should now see a listing of your program -- you may have to readjust window sizes.
Now, on the toolbar, you should click the "Start" button (a green right arrow -- hover
over it to see "Start").
Now set a breakpoint at the first line inside main -- you set a break point
by clicking in the gray column on the left side of the program listing --
after setting a break point, you should see a pink box at the point where you clicked.
Now, on the toolbar, click on the "Continue" button (a yellow arrow).
This will start your program and run it until you hit your break point.
At this point, you can set more breakpoints, using the Continue button as above,
or you can "single step" through your program, using the "Step into", "Step over",
etc., buttons on the toolbar.
In the lower left corner of the main window, you can see the values of all currently
visible variables -- you may have to click on the Windows -> Debugging -> Variables tab to bring up this window.
There is much more that you can do -- see the corresponding help pages,
and play around with it.