Stepping Through Your Program in the Java Debugger

See Also

After execution of your program is halted, you can step through your lines of code using the following commands in the Debug menu or the corresponding icons in the toolbar.

Command Icon Description
Step Over (F8) Step Over icon Executes one source line. If the source line contains a call, executes the entire routine without stepping through the individual instructions.
Step Over Expression (Shift-F8) Step Over Expression icon Executes one method call in an expression. If an expression has multiple method calls, you can use Step Over Expression to step through an expression and view the value of each method call in the expression in the Variables window. Each time you use the Step Over Expression command, the debugger advances to the next method call in the expression and the completed method call is underlined. Step Over Expression behaves like Step Over when there are no additional method calls.
Step Into (F7) Step Into icon Executes one method call in a source line. If the line has more than one method call you can choose which method call to step into by using the arrow keys or mouse in the source editor to select the method call. The selected method call to step into is indicated by a box around the method call in the source editor. The most likely method call in the line is selected by default.
Step Into Next Method (Shift-F7)   Executes one source line. If the source line contains a call, the IDE stops just before executing the first statement of the routine. You can also start a debugging session with the Step Into command. Program execution stops on the first line after the main routine before any changes have been made to the state of the program.
Step Out (Ctrl-F7) Step Out icon Executes one source line. If the source line is part of a routine, executes the remaining lines of the routine and returns control to the caller of the routine. The completed method call is highlighted in the Source Editor.
Run to Cursor (F4) Run to Cursor icon Runs the program to the cursor location in the Source Editor and pauses the program. The file you have selected in the Source Editor must be called from the main class of the main project.

Notes:

See Also
Stepping Through an Expression
Setting a Java Breakpoint
Starting a Local Debugging Session
Starting a Remote Debugging Session
Attaching Source Code to a JAR File

Legal Notices