Debugging From the Source Editor
Once you've started a debugging session, you can also debug your program from the Source Editor. The Source Editor automatically opens with your program sources loaded when you start a debugging session. The Source Editor fronts (or opens) each time you step through your program or your program stops at a breakpoint. The line in which program execution stops is highlighted in green.
The Source Editor provides eight debugging controls. These controls are only active when a project is loaded in the Debugger.

Toggle Breakpoint
- Toggle for setting and removing breakpoints in the selected line of a class. If you move the cursor to a line that does not have a breakpoint and click this control, the Java WorkShop sets a breakpoint on the line. If you move the cursor to a line that has a breakpoint and click this control, the WorkShop removes the breakpoint.
To set and remove breakpoints using the Source Editor, your source file must meet one of the following conditions:
- The source file is built within the Java WorkShop
- The file is a JDK class or source file
- The class is already loaded into memory

Restart (Shift-F6)
- Restarts the project. All breakpoints and exceptions are retained across restarts.

Resume all (F6)
- Resumes execution of all threads.

Run to here (Shift-F8)
- Executes the program until it reaches the line that contains the cursor. This command is only available in the Source Editor.

Step over (F7)
- Executes one source line; if the source line is a method call, the WorkShop executes the entire method without stepping through the individual method instructions.

Step into (F8)
- Executes one source line; if the source line is a method call, the WorkShop executes the first statement of the method and stops.

Up a frame (F9)
- Moves up the call stack one frame.

Down a frame (Shift-F9)
- Moves down the call stack one frame.
The Source Editor uses the color highlights to relate information about a line of code.
- Green
- Indicates the line that was executing when the program stopped
- Red
- Indicates a breakpoint is set in the line
- Yellow
- Indicates the line contains an error
- Purple
- Indicates one of the following:
- A method was stepped into for which the source code was not available
- The method call of the current stack frame, if you selected a stack frame in the interior of the current thread's stack
- Code viewed from the Source Browser
- Blue
- Indicates a Source Browser match
See also:
- Introduction to the Java WorkShop Debugger