1. Install Arthas

    curl -O https://alibaba.github.io/arthas/arthas-boot.jar
    Copy the code
  2. Start the Arthas

    java -jar arthas-boot.jar
    Copy the code
  3. Select the Java process to operate on

  4. The jad command decompiles the files that need to be changed, saves them, and the compiler modifies them

    jad  --source com.runlion.middleground.user.api.dto.CementRatioInfoDTO > /data/CementRatioInfoDTO.java
    Copy the code
  5. The SC command finds which classLoader loaded the current class

    sc -d com.runlion.middleground.user.api.dto.CementRatioInfoDTO | grep classLoader
    Copy the code

  6. The MC command recompiles the class in memory with the specified classloader

     mc -c 45a37759 /data/CementRatioInfoDTO.java -d /data
    Copy the code

  7. The re-define command loads the compiled class into the JVM

    redefine /data/com/runlion/middleground/user/api/dto/CementRatioInfoDTO.class
    Copy the code