Skip to content
Frank edited this page Apr 21, 2024 · 4 revisions

Welcome to the JVMByteSwapTool wiki!

1 Introduce

JVMByteSwapTool (jbs) is a jvm diagnose tool that can swap the class bytecode without restart Java process. It's similar to Alibaba Arthas, but more lightweight, less code, also less features. I just add several most useful features to this tool. This tool has a very user-friendly web UI. It is easy to use, yet it possesses powerful features.

2 Install

Prepare java environment, of course, it's needed. This tool is built by Java 1.8, so you need a Java >= 1.8.

Download swapper.jar file with lastest verion from release page, unzip the file, get a swapper.jar.

3 Bootstrap

First, start up a java process that you want to attach and swap bytecode. If you just want to have a try, you can run the demo.jar in the demo directory of this github repo. It's a simple spring boot project, here is the source code.

$ java -jar demo/demo.jar
# sprint start...

$ curl 'http://localhost:8080/add?a=1&b=2'
3

$ curl 'http://localhost:8080/base64?str=123'
Base64(123) = MTIz

$ curl 'http://localhost:8080/user/1'
{"id":1,"name":"A"}

Secondly, run the swapper.jar to attach this process.

$ java -jar swapper.jar
# choose the process

mintty_313DpwrdZo

Visit url http://localhost:8000, the web ui is showed as following.

chrome_GHTgLJXXNp

Go to the usage wiki page, will show you how to use the jbs tool.

4 tui

In some cases, local network cannot connect to the server. So that, the web ui is unaccessable. You can also use the tui named jbs-client, also can get it from release page.

Similar with web ui, using tab to change selection, enter to select.

chrome_HlLPWXMbc7

Clone this wiki locally