Stepping and Resuming

After DrJava reaches a breakpoint, the method being called is suspended, and several commands in the Debug Menu and Debug Panel become available. Choosing "Resume" allows the current method to finish execution, at least until another breakpoint is reached. If any other threads are suspended when you resume, the Interactions Pane will switch to the most recently suspended thread. Otherwise, the original ("top level") prompt is restored. Alternatively, you can use the Step commands in the Debug menu to step through the execution of the method, one line at a time. Each time a step completes, the debugger highlights the next line of code to be executed. If the code is in another file, the debugger will look for the file on the Sourcepath and attempt to open it.

Step Into. The Step Into command will walk into any method calls that occur in the code, possibly opening additional files.

Step Over. The Step Over command will not enter any new method calls, treating them instead as a single operation to be stepped over.

Step Out. The Step Out command will finish running the current method and stop at the next line of code from where the method was called.

Sourcepath and Step Options. The sourcepath is the set of directories in which to look for source files when stepping. It can be set in the Debugger section of the Preferences window (which can be opened from the Edit menu). This section in the Preferences also contains options for controlling which classes will be included as part of stepping. By default, DrJava will never step into its own source, nor its Java Interpreter (DynamicJava), nor Java itself. If you are interested, and have downloaded the source files, you can enable these options to see how Java or DrJava works. You can also specify which classes and packages you want to exclude when stepping. To exclude specific classes, type in the qualified class name (the package name followed by a period and the class name). To exclude entire packages (as well as their subpackages), type the package name followed by a period and an asterisk. Each class or package name must be separated by a comma.

Automatic Trace. The Automatic Trace command allows the user to execute periodic "Step Into" commands, by default every 1000 milliseconds. This will cause DrJava to execute the program line by line, entering called methods. After such a periodic step, the user has the option oof disabling the automatic trace by pressing the "Disable Automatic Trace" button. If the automatic trace is not disabled, the program will run its course, and the automatic trace will be turned off at the end of the program. The user can change the delay interval for stepping located in DrJava's preferences.