Java Debugging With Eclipse IDE
Java Debugging With Eclipse IDE
Debugging allows you to run a program interactively while watching the source
code and the variables during the execution.
A breakpoint in the source code specifies where the execution of the program
should stop during debugging. Once the program is stopped you can investigate
variables, change their content, etc.
Here are some quick tips and tools that will help you get started quickly with
debugging your Java project.
2. Run a program in debug mode
• Right click on the class contain method main() -> Debug As -> Java Application.
• Click the Debug button -> Debug As -> Java Application.
4. Debug Perspective
The debug perspective offers additional views that can be used to troubleshoot
an application like Breakpoints, Variables, Debug, Console etc. When a Java program
is started in the debug mode, users are prompted to switch to the debug perspective.
• Debug view – Visualizes call stack and provides operations on that.
• Breakpoints view – Shows all the breakpoints.
• Variables/Expression view – Shows the declared variables and their values.
Press Ctrl+Shift+D or Ctrl+Shift+i on a selected variable or expression to
show its value. You can also add a permanent watch on an expression/variable
that will then be shown in the Expressions view when debugging is on.
• Display view – Allows to Inspect the value of a variable, expression, or selected
text during debugging.
• Console view – Program output is shown here.
5. Stepping commands
The Eclipse Platform helps developers debug by providing buttons in the toolbar
and key binding shortcuts to control program execution.
If a Breakpoint is encountered, the program will stop for you to control and
monitor. As you can see, the program will stop at Breakpoint at line number 7:
--------oooooENDooooo--------