Eclipse Debug debugging
Debug debug Java program
We can debug Java program in Package Explorer view, the steps are as follows:
right mouse Click on the java class containing the main function
Select Debug As > Java Application
This operation can also be completed through shortcut keys, shortcut keys The combination is Alt + Shift + D, J.
The above operation will create a new Debug Configuration (debug configuration) and use this configuration to start the Java application.
If the Debug Configuration has been created, you can select Debug Configurations through the Run menu, select the corresponding class and click the Debug button to start the Java application.
The Debug menu item of the Run menu can reload a java application that previously used debug mode.
The shortcut key for reloading a java application that was previously in debug mode is F11.
When using debug mode to open a java program, the user will be prompted to switch to the debug perspective. The debug perspective provides additional views for troubleshooting your application.
The java editor can set breakpoints for debugging. Set a breakpoint for debugging by right-clicking the marker bar in the editor and selecting Toggle Breakpoint.
Breakpoints can be seen in the marker bar. Can also be seen in Breakpoints View.
When the program executes the code marked by the breakpoint, the JVM will suspend the program. At this time, you can view the memory usage and control the program execution.
When the program hangs, the Debug view can inspect the call stack.
The variables view can view the values of variables.
The Run menu has the Resume menu item, Step Over a line of code, Step Into, etc.
The above picture shows the associated shortcut key operations such as Resume, Step Into and Step Over.