Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Eclipse Debug Debugging

Eclipse Debug Debugging


Debugging Java programs with Debug

We can debug Java programs in the Package Explorer view. The steps are as follows:

This operation can also be done with a keyboard shortcut: Alt + Shift + D, J.

The above operation creates a new Debug Configuration , and uses this configuration to launch the Java application.

If a Debug Configuration has already been created, you can select Debug Configurations from the Run menu, choose the corresponding class, and click the Debug button to launch the Java application.

The Debug menu item in the Run menu can reload a java application that was previously launched in debug mode.

The shortcut to reload a java application previously launched in debug mode is F11.

When a java program is launched in debug mode, the user is prompted to switch to the Debug perspective. The Debug perspective provides other views for troubleshooting the application.

The java editor can set breakpoints for debugging. Right-click the marker bar in the editor and select Toggle Breakpoint to set a breakpoint.

Breakpoints can be seen in the marker bar. They can also be seen in the Breakpoints View.

When the program executes the code marked by a breakpoint, the JVM suspends the program, and you can then view memory usage and control program execution.

When the program is suspended, the Debug view can inspect the call stack.

The variables view can display the values of variables.

The Run menu contains menu items such as Resume, Step Over a line of code, and Step Into a function.

The image above shows the keyboard shortcuts associated with Resume, Step Into, and Step Over.