Skip to content

Commit

Permalink
修复jre文件夹找不到的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
monkeyWie committed Jan 20, 2018
1 parent e70abf5 commit 7340029
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions update/src/main/java/lee/study/down/Bootstrap.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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;
}
Expand Down

0 comments on commit 7340029

Please sign in to comment.