Backend Development 14 min read

A Comprehensive Guide to Using Arthas for Java Application Debugging and Monitoring

This article introduces Arthas, Alibaba's open‑source Java diagnostic tool, explains its installation, showcases common commands such as stack, jad, sc, watch, trace, jobs, logger, dashboard, and redefine, and demonstrates how to use them to monitor JVM status, trace method calls, inspect classes, and perform hot‑updates without restarting the application.

Top Architect
Top Architect
Top Architect
A Comprehensive Guide to Using Arthas for Java Application Debugging and Monitoring

Arthas is an open‑source Java diagnostic utility from Alibaba that enables dynamic tracing, class inspection, and real‑time JVM monitoring without stopping the target process. It supports JDK 6+ on Linux, macOS, and Windows.

Installation : download the boot jar with wget https://alibaba.github.io/arthas/arthas-boot.jar and start it using java -jar arthas-boot.jar . Select the Java process to attach to by entering its number.

Common commands :

stack <class> <method> – prints the call stack of the specified method.

jad <class> [<method>] – decompiles the loaded class (or a specific method) to source code.

sc <pattern> – searches loaded classes; sc -d <class> shows detailed class info.

watch <class> <method> "{params,returnObj}" -x 2 – monitors method parameters and return values.

trace -j <class> <method> – traces internal method calls with timing.

jobs – lists background asynchronous tasks; kill <id> terminates them.

logger --name ROOT --level debug – queries or updates logger levels.

dashboard – shows a real‑time overview of JVM threads, CPU usage, and memory.

redefine -c <classLoaderHash> <class>.class – hot‑updates a loaded class without restarting.

Typical usage scenarios include locating the JAR that loaded a class, verifying whether code changes have taken effect, debugging production issues without adding log statements, monitoring performance‑critical methods, and performing live class hot‑replacements.

When attaching fails due to port conflicts, restart Arthas with a different telnet port (e.g., java -jar arthas-boot.jar --telnet-port 9998 --http-port -1 ) or shut down the conflicting process.

The article also provides tips for using background jobs, adjusting job timeouts, and interpreting thread information such as name, group, priority, state, CPU%, and daemon status.

debuggingArthasJVM monitoringdiagnostic tool
Top Architect
Written by

Top Architect

Top Architect focuses on sharing practical architecture knowledge, covering enterprise, system, website, large‑scale distributed, and high‑availability architectures, plus architecture adjustments using internet technologies. We welcome idea‑driven, sharing‑oriented architects to exchange and learn together.

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.