Using IDE Debugger In Java
In the Java programming language, an IDE debugger helps Java developers run or execute Java program source code step-by-step, inspect existing classes, program variables, data types, and methods, and understand program flow in detail, helping them find and correct unnecessary issues or bugs in simple to complex programs. An IDE in Java is a graphical user interface application software package that helps Java software developers design, develop, test, and deploy Java programs.

Popular Java IDE debugger applications, such as IntelliJ IDEA, Eclipse, and Microsoft VS Code, offer source code debugging, testing, and analysis software control features.
Set a Java source code breakpoint.
A breakpoint in a Java program source code tells the Java IDE debugger to stop program execution issues at a specific line number.
Example of a source code breakpoint.
public int count_Value(int rate, int quantity) {
int total_value = rate * quantity; // Java IDE debugger Breakpoint here
return total_value;
}
Explanation of source code breakpoint.
- To create a breakpoint in a Java program source code, click next to a line number in your IDE software.
- When your program reaches that line, its execution automatically stops.
Start debugging the Java source code from the IDE.
Instead of executing a Java program source code normally, select the Debug option in your Java IDE application. This stops your current Java program at that execution breakpoint.
Your Java program starts.
↓
A user-defined method is executed.
↓
When the breakpoint is reached,
↓
Its execution stops.
↓
Finally, view the program’s state.
Java users can view the following in their current program.
- All local variables declared in their program.
- Method parameters defined in local classes.
- Multiple Java class object properties.
- Call stack methods.
- Current source code execution line.
Step-over concept in Java IDE.
The Step-over Java IDE option executes the current line in the Java program source code, and then moves to the next line.
For the Step-over option:
int rate = 78;
int quantity = 7;
int total = rate * quantity;
Here, Step Over moves through it.
rate = 78
↓
quantity = 7
↓
total = 546
Step Over concept doesn’t normally enter the Java class method being called from the current line.
Step Into concept in Java IDE.
The Step Into Java IDE option enters the class method being called in the Java program source code.
Step Into step.
int total = count_Value(rate, quantity);
This Step Into takes you inside:
private int count_Value(int rate, int quantity) {
return rate * quantity;
}
The Step Into option in Java source code is used when you suspect the problem lies within the method being called.
Step Out concept in Java IDE.
Step Out Java IDE Option If the Java user is inside a method in the Java program source code, and the Java user does not need to inspect the remaining program source code, the Step Out option completes the current method and returns to its caller.
main() function
↓
count_Value()
↓
Step Out option
↓
main() method
Inspect Java program data type variables.
Let’s say the Java user has:
public int findDiscount(int rate, int discount) {
int total_amount = rate * discount / 100;
return rate – total_amount;
}
This expression allows the Java user to view the source code in detail while debugging.
rate = 1000
discount = 20
total_amount = 200
This makes it much easier to identify unexpected data values in this expression.
Watch Expression Concept in Java IDE.
Most Java IDE application software provides Java users with features to add expressions to the Watch window.
Example of a Java Watch Expression.
rate * discount / 89
Java users can watch updated modifications to its value as they progress through their program.
This is a useful concept for complex calculations and object properties in Java source code.
Conditional Breakpoint concept in Java IDE.
Sometimes Java users don’t want the debugger IDE to stop every time a program source code line is executed.
Example of a Conditional Breakpoint.
for (Order order : orders) {
process(order); // conditional breakpoint situation
}
Java users can configure the breakpoint method to stop only when:
order.getId() == 47
Here, it’s called the conditional breakpoint method.
This is useful for debugging specific orders in Java.
Call stack concept in Java IDE.
The call stack method in a Java program represents how the program reached the current line.
Example of the call stack concept.
OrderController.developOrder()
↓
OrderService.moveOrder()
↓
PaymentService.checkout()
↓
PaymentService.validate()
If the debugger stops inside the validate() function in this code, the call stack indicates to the Java user which methods were called.
This is a very useful method for a Java developer to understand a complex Java application.
Exception debugging concept in Java IDE.
When an exception is thrown in a Java source code program, the debugger can stop at that point.
Example of the exception debugging concept.
public void task(Client client) {
String emp_name = client.getemp_Name();
}
If the client value is null, a NullPointerException may be thrown.
Configuring the debugger to break when an exception is thrown in this condition allows you to inspect the correct state at the failure point.
Debugging workflow in the Java IDE debugger.
When a program’s source code in Java behaves incorrectly.
Recreate your problem
↓
Set the necessary breakpoints
↓
Start program debugging
↓
Look at the program’s data type variables
↓
Step over/into the concept
↓
Look at the call stack task
↓
Find the incorrect state
↓
Fix your source code
↓
Finally, run the unit test
Java IDE debugger vs. System.out.println() method.
Add these details instead in Java.
System.out.println(“rate = ” + rate);
System.out.println(“discount = ” + discount);
System.out.println(“total_value = ” + total_value);
An IDE debugger in a Java program helps Java users preview these values without modifying or updating the program source code.
The main idea of a Java IDE debugger.
An IDE debugger in a Java program helps Java users pause a running Java program source code and examine its current state step by step, making it much easier to find the source of a program bug.

