<divid="app"><!--[--><divclass="theme-container"><!--[--><headerclass="navbar"><divclass="toggle-sidebar-button"title="toggle sidebar"aria-expanded="false"role="button"tabindex="0"><divclass="icon"aria-hidden="true"><span></span><span></span><span></span></div></div><span><ahref="/en/"class=""><!----><spanclass="site-name can-hide">arthas</span></a></span><divclass="navbar-items-wrapper"style=""><!--[--><!--]--><navclass="navbar-items can-hide"><!--[--><divclass="navbar-item"><ahref="/en/"class=""aria-label="HOME"><!--[--><!--]--> HOME <!--[--><!--]--></a></div><divclass="navbar-item"><aclass="external-link"href="/doc/arthas-tutorials.html?language=en&id=arthas-basics"rel="noopener noreferrer"target="_blank"aria-label="ONLINE TUTORIALS"><!--[--><!--]--><span>ONLINE TUTORIALS</span><span><svgclass="external-link-icon"xmlns="http://www.w3.org/2000/svg"aria-hidden="true"focusable="false"x="0px"y="0px"viewbox="0 0 100 100"width="15"height="15"><pathfill="currentColor"d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygonfill="currentColor"points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><spanclass="external-link-icon-sr-only">open in new window</span></span><!--[--><!--]--></a></div><divclass="navbar-item"><ahref="/en/doc"class="router-link-active"aria-label="DOCS"><!--[--><!--]--> DOCS <!--[--><!--]--></a></div><divclass="navbar-item"><divclass="navbar-dropdown-wrapper"><buttonclass="navbar-dropdown-title"type="button"aria-label="SOLUTIONS"><spanclass="title">SOLUTIONS</span><spanclass="arrow down"></span></button><buttonclass="navbar-dropdown-title-mobile"type="button"aria-label="SOLUTIONS"><spanclass="title">SOLUTIONS</span><spanclass="right arrow"></span></button><ulstyle="display:none;"class="navbar-dropdown"><!--[--><liclass="navbar-dropdown-item"><aclass="external-link"href="https://cn.aliyun.com/product/aliware/mse?spm=arthas.topbar.0.0.0"rel="noopener noreferrer"target="_blank"aria-label="Microservice solutions"><!--[--><!--]--><span>Microservice solutions</span><span><svgclass="external-link-icon"xmlns="http://www.w3.org/2000/svg"aria-hidden="true"focusable="false"x="0px"y="0px"viewbox="0 0 100 100"width="15"height="15"><pathfill="currentColor"d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygonfill="currentColor"points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><spanclass="external-link-icon-sr-only">open in new window</span></span><!--[--><!--]--></a></li><liclass="navbar-dropdown-item"><aclass="external-link"href="https://www.aliyun.com/aliware/txc?spm=arthas.topbar.0.0.0"rel="noopener noreferrer"target="_blank"aria-label="Distributed transaction solutions"><!--[--><!--]--><span>Distributed transaction solutions</span><span><svgclass="external-link-icon"xmlns="http://www.w3.org/2000/svg"aria-hidden="true"focusable="false"x="0px"y="0px"viewbox="0 0 100 100"width="15"height="15"><pathfill="currentColor"d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygonfill="currentColor"points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><spanclass="external-link-icon-sr-only">open in new window</span></span><!--[--><!--]--></a></li><liclass="navbar-dropdown-item"><aclass="external-link"href="https://www.aliyun.com/product/ahas?spm=arthas.topbar.0.0.0"rel="noopener noreferrer"target="_blank"aria-label="High-availability solution"><!--[--><!--]--><span>High-availability solution</span><span><svgclass="external-link-icon"xmlns="http://www.w3.org/2000/svg"aria-hidden="true"focusable="false"x="0px"y="0px"viewbox="0 0 100 100"width="15"height="15"><pathfill="currentColor"d="M1
java -jar math-game.jar
</code></pre><divclass="line-numbers"aria-hidden="true"><divclass="line-number"></div><divclass="line-number"></div></div></div><p><code>math-game</code> is a simple program that generates a random number every second, then it finds all prime factors of that number.</p><p>The source code of <code>math-game</code>: <ahref="https://github.com/alibaba/arthas/blob/master/math-game/src/main/java/demo/MathGame.java"target="_blank"rel="noopener noreferrer">View<span><svgclass="external-link-icon"xmlns="http://www.w3.org/2000/svg"aria-hidden="true"focusable="false"x="0px"y="0px"viewbox="0 0 100 100"width="15"height="15"><pathfill="currentColor"d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygonfill="currentColor"points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><spanclass="external-link-icon-sr-only">open in new window</span></span></a></p><h2id="_2-start-arthas"tabindex="-1"><aclass="header-anchor"href="#_2-start-arthas"aria-hidden="true">#</a> 2. Start Arthas</h2><h3id="linux-unix-mac"tabindex="-1"><aclass="header-anchor"href="#linux-unix-mac"aria-hidden="true">#</a> Linux/Unix/Mac</h3><p>Execute the following command in the command line:</p><divclass="language-bash ext-sh line-numbers-mode"><preclass="language-bash"><code><spanclass="token function">curl</span> -O https://arthas.aliyun.com/arthas-boot.jar
java -jar arthas-boot.jar
</code></pre><divclass="line-numbers"aria-hidden="true"><divclass="line-number"></div><divclass="line-number"></div></div></div><ul><li>The user to run this command <em>MUST</em> have the same privilege as the owner of the target process, as a simple example you can try the following command if the target process is managed by user <code>admin</code>: <code>sudo su admin && java -jar arthas-boot.jar</code> or <code>sudo -u admin -EH java -jar arthas-boot.jar</code></li><li>If you cannot be able to attach to the target process, please check the logs under <code>~/logs/arthas</code> for troubleshooting.</li><li><code>java -jar arthas-boot.jar -h</code> print usage.</li></ul><p>Select the target Java process to attach:</p><divclass="language-bash ext-sh line-numbers-mode"><preclass="language-bash"><code>$ $ java -jar arthas-boot.jar
</code></pre><divclass="line-numbers"aria-hidden="true"><divclass="line-number"></div><divclass="line-number"></div><divclass="line-number"></div></div></div><p>The <code>math-game</code> process is the second as shown above, press '2' then 'Enter'. Arthas will attach to the target process, and start to output:</p><divclass="language-bash ext-sh line-numbers-mode"><preclass="language-bash"><code><spanclass="token punctuation">[</span>INFO<spanclass="token punctuation">]</span> Try to attach process <spanclass="token number">71560</span>
<spanclass="token punctuation">[</span>INFO<spanclass="token punctuation">]</span> Attach process <spanclass="token number">71560</span> success.
</code></pre><divclass="line-numbers"aria-hidden="true"><divclass="line-number"></div><divclass="line-number"></div><divclass="line-number"></div><divclass="line-number"></div><divclass="line-number"></div><divclass="line-number"></div><divclass="line-number"></div><divclass="line-number"></div><divclass="line-number"></div><divclass="line-number"></div><divclass="line-number"></div><divclass="line-number"></div><divclass="line-number"></div><divclass="line-number"></div><divclass="line-number"></div><divclass="line-number"></div></div></div><h2id="_3-check-the-dashboard"tabindex="-1"><aclass="header-anchor"href="#_3-check-the-dashboard"aria-hidden="true">#</a> 3. Check the Dashboard</h2><p>Type '<ahref="/en/doc/dashboard.html"class="">dashboard</a>' and hit 'ENTER', a brief report on the current process will be shown as below, pls. <code>Ctrl+C</code> to stop:</p><divclass="language-bash ext-sh line-numbers-mode"><preclass="language-bash"><code>$ dashboard
ID NAME GROUP PRIORI STATE %CPU TIME INTERRU DAEMON
</code></pre><divclass="line-numbers"aria-hidden="true"><divclass="line-number"></div><divclass="line-number"></div><divclass="line-number"></div><divclass="line-number"></div><divclass="line-number"></div><divclass="line-number"></div><divclass="line-number"></div><divclass="line-number"></div><divclass="line-number"></div><divclass="line-number"></div><divclass="line-number"></div><divclass="line-number"></div><divclass="line-number"></div><divclass="line-number"></div><divclass="line-number"></div><divclass="line-number"></div><divclass="line-number"></div><divclass="line-number"></div><divclass="line-number"></div><divclass="line-number"></div><divclass="line-number"></div><divclass="line-number"></div><divclass="line-number"></div><divclass="line-number"></div><divclass="line-number"></div><divclass="line-number"></div><divclass="line-number"></div><divclass="line-number"></div><divclass="line-number"></div><divclass="line-number"></div><divclass="line-number"></div></div></div><h2id="_4-get-the-main-class-of-the-math-game-process-with-the-thread-command"tabindex="-1"><aclass="header-anchor"href="#_4-get-the-main-class-of-the-math-game-process-with-the-thread-command"aria-hidden="true">#</a> 4. Get the Main Class of the <code>math-game</code> process with the thread command</h2><p><code>thread 1</code> will print the stack of the thread with ID 1, which usually the main function thread.</p><divclass="language-bash ext-sh line-numbers-mode"><preclass="language-bash"><code>$ thread <spanclass="token number">1</span><spanclass="token operator">|</span><spanclass="token function">grep</span><spanclass="token string">'main('</span>
at demo.MathGame.main<spanclass="token punctuation">(</span>MathGame.java:17<spanclass="token punctuation">)</span>
</code></pre><divclass="line-numbers"aria-hidden="true"><divclass="line-number"></div><divclass="line-number"></div></div></div><h2id="_5-decompile-main-class-with-jad-command"tabindex="-1"><aclass="header-anchor"href="#_5-decompile-main-class-with-jad-command"aria-hidden="true">#</a> 5. Decompile Main Class with jad command</h2><divclass="language-java ext-java line-numbers-mode"><preclass="language-java"><code>$ jad <spanclass="token class-name"><spanclass="token namespace">demo<spanclass="token punctuation">.</span></span>MathGame</span>
</code></pre><divclass="line-numbers"aria-hidden="true"><divclass="line-number"></div><divclass="line-number"></div><divclass="line-number"></div><divclass="line-number"></div><divclass="line-number"></div><divclass="line-number"></div><divclass="line-number"></div><divclass="line-number"></div><divclass="line-number"></div><divclass="line-number"></div><divclass="line-number"></div><divclass="line-number"></div><divclass="line-number"></div><divclass="line-number"></div><divclass="line-number"></div><divclass="line-number"></div><divclass="line-number"></div><divclass="line-number"></div><divclass="line-number"></div><divclass="line-number"></div><divclass="line-number"></div><divclass="line-number"></div><divclass="line-number"></div><divclass="line-number"></div><divclass="line-number"></div><divclass="line-number"></div><divclass="line-number"></div><divclass="line-number"></div><divclass="line-number"></div><divclass="line-number"></div></div></div><p>Pls. refer to <ahref="/en/doc/advanced-use.html"class="">advanced usages</a> for more information.</p><h2id="_7-exit-arthas"tabindex="-1"><aclass="header-anchor"href="#_7-exit-arthas"aria-hidden="true">#</a> 7. Exit Arthas</h2><p>Use <code>quit</code> or <code>exit</code> to disconnect from the current process. The Arthas instance attached to the target process continues to live inside the process, and its port is standby for further connection.</p><p>Use <code>stop</code> command to have Arthas completely quit from the target process.</p></div><!--[--><!--]--></div><footerclass="page-meta right-menu-padding"data-v-e0e60120><divclass="meta-item edit-link"><aclass="external-link meta-item-label"href="https://github.com/alibaba/arthas/edit/master/site/docs/en/doc/quick-start.md"rel="noopener noreferrer"target="_blank"aria-label="Edit this page on GitHub"><!--[--><!--]--><span>Edit this page on GitHub</span><span><svgclass="external-link-icon"xmlns="http://www.w3.org/2000/svg"aria-hidden="true"focusable="false"x="0px"y="0px"viewbox="0 0 100 100"width="15"height="15"><pathfill="currentColor"d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygonfill="currentColor"points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><spanclass="external-link-icon-sr-only">open in new window</span></span><!--[--><!--]--></a></div><divclass="meta-item last-updated"><spanclass="meta-item-label">Last Updated: </span><!----></div><divclass="meta-item contributors"><spanclass="meta-item-label">Contributors: </span><spanclass="meta-item-info"><!--[--><!--[--><spanclass="contributor"title="email: hengyunabc@gmail.com">hengyunabc</span><!--[-->, <!--]--><!--]--><!--[--><spanclass="contributor"title="email: LHearen@126.com">Hearen</span><!--[-->, <!--]--><!--]--><!--[--><spanclass="contributor"title="email: 26602940+0xflotus@users.noreply.github.com">0xflotus</span><!--[-->, <!--]--><!--]--><!--[--><spanclass="contributor"title="email: arteevraina@gmail.com">Arteev Raina</span><!--[-->, <!--]--><!--]--><!--[--><spanclass="contributor"title="email: lhearen@gmail.com">LHearen</span><!--[-->, <!--]--><!--]--><!--[--><spanclass="contributor"title="email: ian.luo@gmail.com">beiwei30</span><!--[-->, <!--]--><!--]--><!--[--><spanclass="contributor"title="email: 1412950785@qq.com">garenchan</span><!----><!--]--><!--]--></span></div></footer><navclass="page-nav right-menu-padding"data-v-e0e60120><pclass="inner"><spanclass="prev"><ahref="/en/doc/"class="router-link-active"aria-label="Introduction"><!--[--><!--]--> Introduction <!--[--><!--]--></a></span><spanclass="next"><ahref="/en/doc/install-detail.html"class=""aria-label="Install Arthas"><!--[--><!--]--> Install Arthas <!--[--><!--]--></a></span></p></nav><!--[--><!--]--></main><!--]--></div><!----><!--]--></div>