Select Project|
[0]Enable Debugger. (On a Mac, this changes command Run in menu Project to Debug.) Then select Project|
[0]Debug to have the debugger execute your program.
The debugger's program window (with an uninformative title like AppClasses.jar) opens automatically when you Debug (instead of Run) a program. Another useful window is the class browser window, which you can create with View|
[0]Class Browser on PC. (On a Mac, you can create with Window|
[0]New Class
Browser.)
The program window contains two panes on top and one on the bottom. A list of active methods is in the upper-left panel. The bottom panel displays the source file containing the method whose name is selected in the list and the upper-right panel displays its local variables. An arrow appears to the left of the next statement to be executed in each active method. Initially, execution is paused at the first statement of method main.
The browser window has four panes. (There are also four tabs; in CS100, we care about only Java and Methods, not Properties and Events.) It can be used to view any class in the program, not just those containing currently active methods. The left-most pane contains a list of classes in the program. When a class name is selected, its methods are shown listed in the top-left pane and its class and instance variables are listed in the top-right pane. Select a method name to view its source code in the bottom pane.
Arrange the debugger's windows on the screen so they don't overlap other windows, like the input/output console window, that you want to see while debugging. You can change the size of the debugger's windows by dragging the lower right corner, as usual. To adjust the size of individual panes in the windows, use the mouse to drag the vertical or horizontal bars between them.
When the debugger begins executing your program, it usually pauses at
the first statement. You can cause execution to proceed by selecting
Project|
[0]Run (this assumes you have first selected
Debug). Select Run twice if the first selection only brings
the program window forward without actually executing the program.
Alternatively, you can execute the program one statement at a time, as
discussed in Section 2.3.