update doc

This commit is contained in:
hengyunabc committed 2019-03-05 16:00:34 +08:00
1 parent 7af8d8c962
commit fa54fde928
10 files changed
+90 -2

No files matched your search

+2
View File
@@ -20,3 +20,5 @@ mc -d /tmp/output /tmp/ClassA.java /tmp/ClassB.java
```
After compiling the `.class` file, you can use the [redefine](redefine.md) command to re-define the loaded classes in JVM.
> Note that the mc command may fail. If the compilation fails, the `.class` file can be compiled locally and uploaded to the server. Refer to the [redefine](redefine.md) command description for details.
+20
View File
@@ -36,6 +36,26 @@ redefine /tmp/com/example/demo/arthas/user/UserController.class
* `mc` command to compile the modified code
* Load new bytecode with `redefine` command
### Tips for uploading .class files to the server
The `mc` command may fail. You can modify the code locally, compile it, and upload it to the server. Some servers do not allow direct uploading files, you can use the `base64` command to bypass.
1. Convert the `.class` file to base64 first, then save it as result.txt
```bash
Base64 < Test.class > result.txt
```
2. Login the server, create and edit `result.txt`, copy the local content, paste and save
3. Restore `result.txt` on the server to `.class`
```
Base64 -d < result.txt > Test.class
```
4. Use the md5 command to verify that the `.class` files are consistent.
### Restrictions of the redefine command