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 12df5e8c7..16f797175 100644 --- a/boot/src/main/java/com/taobao/arthas/boot/Bootstrap.java +++ b/boot/src/main/java/com/taobao/arthas/boot/Bootstrap.java @@ -319,6 +319,15 @@ public class Bootstrap { } } + try { + String javaToolOptions = System.getenv("JAVA_TOOL_OPTIONS"); + if (javaToolOptions != null && !javaToolOptions.trim().isEmpty()) { + AnsiLog.info("JAVA_TOOL_OPTIONS: " + javaToolOptions); + } + } catch (Throwable e) { + // ignore + } + Bootstrap bootstrap = new Bootstrap(); CLI cli = CLIConfigurator.define(Bootstrap.class); diff --git a/boot/src/main/java/com/taobao/arthas/boot/ProcessUtils.java b/boot/src/main/java/com/taobao/arthas/boot/ProcessUtils.java index ce0b11afa..b75f045c7 100644 --- a/boot/src/main/java/com/taobao/arthas/boot/ProcessUtils.java +++ b/boot/src/main/java/com/taobao/arthas/boot/ProcessUtils.java @@ -266,6 +266,8 @@ public class ProcessUtils { // -agent "${arthas_lib_dir}/arthas-agent.jar" ProcessBuilder pb = new ProcessBuilder(command); + // https://github.com/alibaba/arthas/issues/2166 + pb.environment().put("JAVA_TOOL_OPTIONS", ""); try { final Process proc = pb.start(); Thread redirectStdout = new Thread(new Runnable() {