Fundamentals 7 min read

Master IntelliJ IDEA Debugging: Advanced Tips Every Java Developer Needs

Learn how to leverage IntelliJ IDEA's powerful debugging features—including step commands, conditional breakpoints, thread inspection, and expression evaluation—plus troubleshoot common startup errors and automatically generate serialVersionUID, providing essential techniques for Java developers to debug efficiently and resolve IDE issues.

Lin is Dream
Lin is Dream
Lin is Dream
Master IntelliJ IDEA Debugging: Advanced Tips Every Java Developer Needs

Debugging is one of the most important capabilities of an IDE (Integrated Development Environment) like IntelliJ IDEA, yet many developers only use line‑by‑line debugging.

IntelliJ IDEA provides powerful debugging tools that support step execution, conditional breakpoints, variable monitoring, dynamic value modification, and expression evaluation.

IDEA Debugging Overview
IDEA Debugging Overview

IDEA Debug Operations

Step Over (F8): Execute the current line and move to the next, treating method calls as a single step.

Step Into (F7): When encountering a user‑defined method, dive into it and continue stepping.

Force Step Into: Enter any method, including JDK system methods.

Step Out: Exit the current method and return to the caller.

Drop Frame: Return to the previous method frame and re‑execute, but modified variables cannot be changed again.

Run to Cursor: Execute until the cursor position within the current method.

Evaluate Expression: Compute the value of an expression on the fly.

Trace Current Stream Chain

Resume Program: Continue execution until the next breakpoint or program end.

Pause Program: Pause execution (rarely used).

View Breakpoints…: Manage all breakpoints, enable/disable selectively.

Mute Breakpoints: Temporarily disable breakpoints.

Force Return: Force a method to return a specific value via the call stack.

One‑Time Breakpoint (Option‑click): Breakpoint that auto‑removes after being hit once.

Get Thread Dump: Capture a snapshot of all active thread stacks for performance analysis.

Debug Asynchronous Threads

When testing asynchronous code, place a breakpoint inside the async thread. By default the breakpoint pauses all threads; set it to pause only the current thread to avoid stopping the main thread.

Async Thread Debugging
Async Thread Debugging

Project Startup Failure: How to Fix

If IDEA shows java: Compilation failed: internal java compiler error , try the following:

Increase the heap size from 700 MB to 1024 MB via Settings → Build, Execution, Deployment → Compiler → User‑local build process heap size.

Invalidate caches and restart: File → Invalidate Caches / Restart.

IDEA Cannot Start After Memory Change

The startup failure is caused by an incorrect ReservedCodeCacheSize value. The log shows Invalid ReservedCodeCacheSize=10240M. Must be at most 2048M. The JVM limit for ReservedCodeCacheSize is 2048 MB (2 GB). Adjust the setting in the idea.vmoptions file.

/Users/xx/Library/Application Support/JetBrains/IntelliJIdea2020.3/idea.vmoptions

Open idea.vmoptions and locate the ReservedCodeCacheSize entry. -XX:ReservedCodeCacheSize=10240M Change it to a value not exceeding 2048 M, e.g., -XX:ReservedCodeCacheSize=2048M Save the file and restart IntelliJ IDEA.

Ensure other settings in idea.vmoptions also comply with JVM requirements.

How IDEA Automatically Generates serialVersionUID

serialVersionUID is a version identifier used by Java's serialization mechanism. It ensures consistency during serialization and deserialization of classes that implement java.io.Serializable.

IDEA can generate this field automatically when creating a class. The generation option can be found in the IDE settings.

debuggingJavaTroubleshootingIntelliJ IDEAIDE
Lin is Dream
Written by

Lin is Dream

Sharing Java developer knowledge, practical articles, and continuous insights into computer engineering.

0 followers
Reader feedback

How this landed with the community

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.