Step-through code

Stepping through the execution of a Java program

When a thread is suspended, the step controls can be used to step through the execution of the program line-by-line. While performing a step operation, if a breakpoint is encountered, execution suspends at the breakpoint, and the step operation ends.

Step over

  1. Select a stack frame in the Debug view. The current line of execution in that stack frame is highlighted in the editor in the Debug perspective.

  2. Click the Step Over button in the Debug view toolbar, or press the F6 key. The currently-selected line is executed and suspends on the next executable line.

    Step over

Step into

  1. Select a stack frame in the Debug view. The current line of execution in that stack frame is highlighted in the editor in the Debug perspective.

  2. Click the Step Into button in the Debug view toolbar, or press the F5 key. The next expression on the currently-selected line to be executed is invoked, and execution suspends at the next executable line in the method that is invoked.

    Step into

Run to return

  1. Select a stack frame in the Debug view. The current line of execution in that stack frame is highlighted in the editor in the Debug perspective.

  2. Click the Run to Return button in the Debug view toolbar, or press the F7 key. Execution resumes until the next return statement in the current method is executed, and execution suspends on the next executable line.

    Run to Return

Run to line

When a thread is suspended, it is possible to resume execution until a specified line is executed. This is a convenient way to suspend execution at a line without setting a breakpoint.

  1. Place your cursor on the line at which you want the program to run and select Run to Line from the pop-up menu or use Ctrl + R. Program execution is resumed and suspends just before the specified line is to be executed.

  2. It is possible that the line will never be hit and that the program will not suspend. Breakpoints and exceptions cause a thread to suspend before reaching the specified line.

    Run to line

Professional hosting     Belorussian informational portal         Free SCWCD 1.4 Study Guide     Free SCBCD 1.3 Study Guide     Free SCDJWS 1.4 Study Guide     SCDJWS 1.4 Quiz     IBM Test 000-287. Enterprise Application Development with IBM WebSphere Studio, V5.0 Study Guide     Free Mock Exam Engine