diff --git a/bin/as.sh b/bin/as.sh index 1edce18c2..6f2e26d4c 100755 --- a/bin/as.sh +++ b/bin/as.sh @@ -83,7 +83,9 @@ DIR=$(dirname -- "$(rreadlink "${BASH_SOURCE[0]}")") ARTHAS_HOME= # define arthas's lib -ARTHAS_LIB_DIR=${HOME}/.arthas/lib +if [ -z "${ARTHAS_LIB_DIR}" ]; then + ARTHAS_LIB_DIR=${HOME}/.arthas/lib +fi # target process id to attach TARGET_PID= diff --git a/boot/src/main/java/com/taobao/arthas/boot/Bootstrap.java b/boot/src/main/java/com/taobao/arthas/boot/Bootstrap.java index 75f73ade6..fb23af229 100644 --- a/boot/src/main/java/com/taobao/arthas/boot/Bootstrap.java +++ b/boot/src/main/java/com/taobao/arthas/boot/Bootstrap.java @@ -132,8 +132,14 @@ public class Bootstrap { private String disabledCommands; static { - ARTHAS_LIB_DIR = new File( - System.getProperty("user.home") + File.separator + ".arthas" + File.separator + "lib"); + String arthasLibDirEnv = System.getenv("ARTHAS_LIB_DIR"); + if (arthasLibDirEnv != null) { + ARTHAS_LIB_DIR = new File(arthasLibDirEnv); + } else { + ARTHAS_LIB_DIR = new File( + System.getProperty("user.home") + File.separator + ".arthas" + File.separator + "lib"); + } + try { ARTHAS_LIB_DIR.mkdirs(); } catch (Throwable t) {