improve find tools.jar logic. fix #383

This commit is contained in:
hengyunabc 2018-12-20 17:42:54 +08:00
parent 2b41b241be
commit b6ae49acd2

View File

@ -150,7 +150,10 @@ public class ProcessUtils {
String javaHome = System.getProperty("java.home");
if (JavaVersionUtils.isLessThanJava9()) {
File toolsJar = new File(javaHome, "../lib/tools.jar");
File toolsJar = new File(javaHome, "lib/tools.jar");
if (!toolsJar.exists()) {
toolsJar = new File(javaHome, "../lib/tools.jar");
}
if (!toolsJar.exists()) {
// maybe jre
toolsJar = new File(javaHome, "../../lib/tools.jar");
@ -311,7 +314,10 @@ public class ProcessUtils {
}
String javaHome = findJavaHome();
File toolsJar = new File(javaHome, "../lib/tools.jar");
File toolsJar = new File(javaHome, "lib/tools.jar");
if (!toolsJar.exists()) {
toolsJar = new File(javaHome, "../lib/tools.jar");
}
if (!toolsJar.exists()) {
// maybe jre
toolsJar = new File(javaHome, "../../lib/tools.jar");