Backend Development 13 min read

Comprehensive Guide to Debugging in IntelliJ IDEA

This article provides a detailed walkthrough of using IntelliJ IDEA’s Debug mode, covering interface elements, basic shortcuts, variable inspection, expression evaluation, smart step‑into, conditional breakpoints, multithreaded debugging, frame rollback, and force return techniques for efficient Java development.

IT Xianyu
IT Xianyu
IT Xianyu
Comprehensive Guide to Debugging in IntelliJ IDEA

Overview

Debugging tracks code execution and helps locate exceptions or understand third‑party frameworks. Enabling Debug mode in IntelliJ IDEA allows you to pause at breakpoints, inspect variables, evaluate expressions, and control program flow.

1. Debug Interface

The Debug window shows eight main areas: start/stop service button, breakpoint line numbers, automatic activation of the Debug pane, a set of eight debugging buttons (Show Execution Point, Step Over, Step Into, Force Step Into, Step Out, Drop Frame, Run to Cursor, Evaluate Expression), service controls, method call stack, Variables view, and Watches view.

2. Basic Usage & Shortcuts

Show Execution Point (Alt+F10): jump to the current execution line.

Step Over (F8): move to the next line without entering methods.

Step Into (F7): enter a method on the current line.

Force Step Into (Alt+Shift+F7): enter any method, including library code.

Step Out (Shift+F8): exit the current method.

Drop Frame: revert to a previous stack frame.

Run to Cursor (Alt+F9): continue execution until a selected line.

Evaluate Expression (Alt+F8): compute an expression on the fly.

3. Variable Inspection

Variables can be viewed directly in the editor (inline values), by hovering over a variable, in the Variables pane, or by adding them to Watches. Dragging a variable from Variables to Watches also works.

4. Evaluating Expressions

Use the Evaluate Expression window (Alt+F8) to calculate values without adding print statements. You can also modify variable values here.

5. Smart Step‑Into

When a line contains multiple method calls, Smart Step‑Into (Shift+F7) lists the candidate methods, allowing you to choose which one to enter.

6. Conditional Breakpoints

Set conditions on breakpoints (e.g., exist == true ) so they only trigger when the condition holds. Use View Breakpoints (Ctrl+Shift+F8) to manage all breakpoints, log messages, or evaluate expressions on hit.

7. Multithreaded Debugging

By default IDEA blocks all threads (ALL). Change the breakpoint type to Thread to debug a single thread, and switch threads via the Frames dropdown.

8. Dropping Frames (Rollback)

Use the Drop Frame button or right‑click a stack frame and select Drop Frame to revert execution to an earlier method call. Note that state changes (e.g., modified objects) are not undone.

9. Force Return (Interrupt Debug)

If you need to abort the current request, use Force Return to supply a return value (e.g., results or new HashMap<>() ) and skip the remaining code.

Conclusion

The guide equips developers with essential IntelliJ IDEA debugging techniques, from basic navigation to advanced features like conditional breakpoints, smart step‑into, multithreaded control, frame rollback, and force return, enhancing productivity when troubleshooting Java applications.

DebuggingJavaIntelliJ IDEAIDEbreakpointsdevelopment tools
IT Xianyu
Written by

IT Xianyu

We share common IT technologies (Java, Web, SQL, etc.) and practical applications of emerging software development techniques. New articles are posted daily. Follow IT Xianyu to stay ahead in tech. The IT Xianyu series is being regularly updated.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.