Introduction to the Java WorkShop Debugger

The Java WorkShop Debugger allows you to inspect the threads and classes that make up the current project. To use the Debugger effectively, you must have compiled the current project inside the Java WorkShop and with the -g option. The -g option instructs the javac compiler to generate Debugger information.

You open the Debugger by clicking the Debugger control on the WorkShop tool bar. The Debugger consists of six tabs.

Threads/Stack Tab

The Threads/Stack tab lists the thread groups that make up the current project. Clicking the glyphs on the left, you can view the threads in a thread group, the stack frames in a thread, and the variables local to each stack frame. You can also expand objects and arrays to show all embedded variables. You can suspend and resume threads.

Variables Tab

In the Variables tab, you can evaluate local or global variables that are within the scope of the object whose method you are stopped in. An evaluation tells the value of the variable at the current time. You can also expand objects and arrays to show all embedded variables. You can change the default scope in the Threads/Stack tab.

Breakpoints Tab

In the Breakpoints tab, you can set, view, and remove breakpoints from your program. When you set a breakpoint, you must specify a class and either the name of a method or a source file line number. If you specify a method name, the breakpoint is set in the first instruction in that method.

A quick way to set a breakpoint to use the Source Editor. The Toggle Breakpoint control sets and removes breakpoints from the line you select.

You can set a breakpoint while your program is running. The program runs to the breakpoint and stops.

Exceptions Tab

The Exceptions tab allows a three-way setting for exception handling:

The default is "Break if not caught."

Classes Tab

The Classes tab allows you to examine the packages, classes, and methods in the current project. You can also expand objects and arrays to show all embedded variables. From the Classes tab, you can set and remove breakpoints in each method belonging to a specified class.

Messages Tab

The Messages tab shows the output activities of the project being debugged and the warning messages the debugger generates.


See also:

Debugging From the Source Editor