</code></pre><divclass="line-numbers"aria-hidden="true"><divclass="line-number"></div></div></div></li><li><p>Install Arthas</p><p>It is recommended to completely remove all old versions of Arthas before installation.</p><divclass="language-bash ext-sh line-numbers-mode"><preclass="language-bash"><code><spanclass="token function">sudo</span><spanclass="token function">su</span> admin
<spanclass="token function">rm</span> -rf /home/admin/.arthas/lib/* <spanclass="token comment"># remove all the leftover of the old outdated Arthas</span>
./install-local.sh <spanclass="token comment"># switch the user based on the owner of the target Java process.</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></div></div></li><li><p>Start Arthas</p><p>Make sure <code>stop</code> the old Arthas server before start.</p><divclass="language-bash ext-sh line-numbers-mode"><preclass="language-bash"><code>./as.sh
</code></pre><divclass="line-numbers"aria-hidden="true"><divclass="line-number"></div></div></div></li></ol><h2id="startup-with-as-sh-as-bat"tabindex="-1"><aclass="header-anchor"href="#startup-with-as-sh-as-bat"aria-hidden="true">#</a> Startup with as.sh/as.bat</h2><h3id="linux-unix-mac"tabindex="-1"><aclass="header-anchor"href="#linux-unix-mac"aria-hidden="true">#</a> Linux/Unix/Mac</h3><p>You can install Arthas with one single line command on Linux, Unix, and Mac. Pls. copy the following command and paste it into the command line, then press <em>Enter</em> to run:</p><divclass="language-bash ext-sh line-numbers-mode"><preclass="language-bash"><code><spanclass="token function">curl</span> -L https://arthas.aliyun.com/install.sh <spanclass="token operator">|</span><spanclass="token function">sh</span>
</code></pre><divclass="line-numbers"aria-hidden="true"><divclass="line-number"></div></div></div><p>The command above will download the bootstrap script <code>as.sh</code> to the current directory. You can move it the any other place you want, or put its location in <code>$PATH</code>.</p><p>You can enter its interactive interface by executing <code>as.sh</code>, or execute <code>as.sh -h</code> for more help information.</p><h3id="windows"tabindex="-1"><aclass="header-anchor"href="#windows"aria-hidden="true">#</a> Windows</h3><p>Latest Version, Click To Download: <ahref="https://arthas.aliyun.com/download/latest_version"target="_blank"rel="noopener noreferrer"><imgsrc="https://img.shields.io/maven-central/v/com.taobao.arthas/arthas-packaging.svg?style=flat-square"alt=""title="Arthas"><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><p>Download and unzip, then find <code>as.bat</code> from 'bin' directory. For now this script will only take one argument <code>pid</code>, which means you can only diagnose the local Java process. (Welcome any bat script expert to make it better ❤️)</p><divclass="language-bash ext-sh line-numbers-mode"><preclass="language-bash"><code>as.bat <spanclass="token operator"><</span>pid<spanclass="token operator">></span>
</code></pre><divclass="line-numbers"aria-hidden="true"><divclass="line-number"></div></div></div><p>If you want to diagnose Java process run as windows service, try these commands:</p><divclass="language-bash ext-sh line-numbers-mode"><preclass="language-bash"><code>as-service.bat -port <spanclass="token operator"><</span>port<spanclass="token operator">></span>
</code></pre><divclass="line-numbers"aria-hidden="true"><divclass="line-number"></div><divclass="line-number"></div><divclass="line-number"></div></div></div><p>Use this command to remove arthas service:</p><divclass="language-bash ext-sh line-numbers-mode"><preclass="language-bash"><code>as-service.bat -remove
</code></pre><divclass="line-numbers"aria-hidden="true"><divclass="line-number"></div></div></div><h2id="manual-command-line-startup"tabindex="-1"><aclass="header-anchor"href="#manual-command-line-startup"aria-hidden="true">#</a> Manual command line startup</h2><p>If you fail to boot Arthas with the provided batch file, you could try to assemble the bootstrap command in the following way.</p><ol><li><p>Locate java in the target JVM:</p><ul><li>Linux/Unix/Mac: <code>ps aux | grep java</code></li><li>Windows: open the Process Monitor to search java</li></ul></li><li><p>Assemble bootstrap command:</p><p>Let's suppose we are using <code>/opt/jdk1.8/bin/java</code>, then the command should be:</p><divclass="language-bash ext-sh line-numbers-mode"><preclass="language-bash"><code>/opt/jdk1.8/bin/java -Xbootclasspath/a:/opt/jdk1.8/lib/tools.jar <spanclass="token punctuation">\</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></div></div><p>Note:</p><ul><li><code>-Xbootclasspath</code> adds tools.jar</li><li><code>-jar /tmp/arthas-packaging/arthas-core.jar</code> specifies main entry</li><li><code>-pid 15146</code> specifies the target java process PID</li><li><code>-target-ip 127.0.0.1</code> specifies the IP</li><li><code>-telnet-port 3658 -http-port 8563</code> specifies telnet and HTTP ports for remote access</li><li><code>-core /tmp/arthas-packaging/arthas-core.jar -agent /tmp/arthas-packaging/arthas/arthas-agent.jar</code> specifies core/agent jar package</li></ul><p>If you are running on JDK 1.9 or above,then it's unnecessary to add <code>tools.jar</code> in option <code>-Xbootclasspath</code>.</p><p>You can find the logs from <code>~/logs/arthas/arthas.log</code>.</p></li><li><p>Use telnet to connect once attaching to the target JVM (in step 2) succeeds</p><divclass="language-bash ext-sh line-numbers-mode"><preclass="language-bash"><code>telnet <spanclass="token number">127.0</span>.0.1 <spanclass="token number">3658</span>