From a87f29842e62303cec9718c62832dcb592087433 Mon Sep 17 00:00:00 2001 From: guaidaokakaxi Date: Thu, 14 Jan 2021 11:01:00 +0800 Subject: [PATCH] does not nessary invoke method findJavaHome() twice (#1666) --- boot/src/main/java/com/taobao/arthas/boot/ProcessUtils.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) 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 49d184937..c892c5a4f 100644 --- a/boot/src/main/java/com/taobao/arthas/boot/ProcessUtils.java +++ b/boot/src/main/java/com/taobao/arthas/boot/ProcessUtils.java @@ -233,7 +233,7 @@ public class ProcessUtils { String javaHome = findJavaHome(); // find java/java.exe - File javaPath = findJava(); + File javaPath = findJava(javaHome); if (javaPath == null) { throw new IllegalArgumentException( "Can not find java/java.exe executable file under java home: " + javaHome); @@ -354,8 +354,7 @@ public class ProcessUtils { } } - private static File findJava() { - String javaHome = findJavaHome(); + private static File findJava(String javaHome) { String[] paths = { "bin/java", "bin/java.exe", "../bin/java", "../bin/java.exe" }; List javaList = new ArrayList();