From 734002913cb50e83dd1da15c0f191135f8c12953 Mon Sep 17 00:00:00 2001 From: lee Date: Sat, 20 Jan 2018 19:55:02 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Djre=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E5=A4=B9=E6=89=BE=E4=B8=8D=E5=88=B0=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- update/src/main/java/lee/study/down/Bootstrap.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/update/src/main/java/lee/study/down/Bootstrap.java b/update/src/main/java/lee/study/down/Bootstrap.java index 4884ad0a..7e7df3f5 100644 --- a/update/src/main/java/lee/study/down/Bootstrap.java +++ b/update/src/main/java/lee/study/down/Bootstrap.java @@ -2,7 +2,6 @@ import java.io.BufferedReader; import java.io.File; -import java.io.IOException; import java.io.InputStreamReader; import lee.study.down.util.PathUtil; @@ -25,10 +24,10 @@ public static void main(String[] args) throws Exception { static { String execPath = File.separator + "bin" + File.separator + "java.exe"; - File file = new File( - PathUtil.ROOT_PATH + "jre1.8.0_152" + execPath); - if (file.exists()) { - JAVA_EXEC_HOME = file.getAbsolutePath(); + File dir = new File(PathUtil.ROOT_PATH); + File[] files = dir.listFiles((d, name) -> d.isDirectory() && name.indexOf("jre") > -1); + if (files.length > 0) { + JAVA_EXEC_HOME = files[0].getAbsolutePath()+execPath; } else { JAVA_EXEC_HOME = System.getenv("JAVA_HOME") + execPath; }