Backend Development 15 min read

Arthas Java Diagnostic Tool: Installation, Common Commands, and Usage Guide

This article introduces Arthas, Alibaba's open‑source Java diagnostic tool, explains its installation via wget and java‑jar, and provides detailed usage of common commands such as stack, jad, sc, watch, trace, jobs, logger, dashboard, and redefine for real‑time JVM monitoring and debugging.

Architecture Digest
Architecture Digest
Architecture Digest
Arthas Java Diagnostic Tool: Installation, Common Commands, and Usage Guide

Arthas is an Alibaba‑open‑source Java diagnostic tool that enables dynamic tracing of Java code and real‑time JVM monitoring without stopping the application, supporting JDK 6+ on Linux, macOS, and Windows.

Installation

Download the boot jar and start it with wget https://alibaba.github.io/arthas/arthas-boot.jar followed by java -jar arthas-boot.jar . After starting, select the target application by its number.

Common Commands

1. stack – shows the call stack of a method, e.g., stack com.baomidou.mybatisplus.extension.service.IService getOne .

2. jad – decompiles a loaded class, e.g., jad cn.test.mobile.controller.order.OrderController or jad cn.test.mobile.controller.order.OrderController getOrderInfo .

3. sc (Search‑Class) – searches loaded classes by pattern, e.g., sc *OrderController* or sc -d cn.test.mobile.controller.order.OrderController .

4. watch – monitors method parameters and return values, e.g., watch cn.test.mobile.controller.order.OrderController getOrderInfo "{params,returnObj}" -x 2 .

5. trace – prints the internal call chain with timing, e.g., trace -j cn.test.mobile.controller.order.OrderController getOrderInfo and can filter by cost.

6. jobs – runs commands in background, e.g., trace -j cn.test.mobile.controller.order.OrderController getOrderInfo > test.out & , then list with jobs , manage with options job-timeout 2d and kill 76 .

7. logger – view and update logger levels, e.g., logger --name ROOT --level debug .

8. dashboard – displays real‑time JVM metrics such as thread states, CPU usage, memory usage, and GC statistics.

9. redefine – hot‑updates already loaded classes without restarting; workflow includes decompiling with jad --source-only , editing the source, compiling with mc -c 18b4aac2 OrderController.java -d ./ , and applying with redefine -c 18b4aac2 OrderController.class .

The article also covers troubleshooting when launching Arthas‑boot, such as selecting the correct Java process and changing telnet ports.

debuggingJavaJVMMonitoringPerformanceDiagnosticsArthas
Architecture Digest
Written by

Architecture Digest

Focusing on Java backend development, covering application architecture from top-tier internet companies (high availability, high performance, high stability), big data, machine learning, Java architecture, and other popular fields.

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.