From 7467571c6ff04c793690f358867cbce7492dffe3 Mon Sep 17 00:00:00 2001 From: Konloch Date: Mon, 19 Jul 2021 12:23:25 -0700 Subject: [PATCH] Guess Java Binary Path --- .../java/the/bytecode/club/bytecodeviewer/Configuration.java | 3 ++- src/main/java/the/bytecode/club/bytecodeviewer/Constants.java | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/Configuration.java b/src/main/java/the/bytecode/club/bytecodeviewer/Configuration.java index 2b608fc7..b109edcd 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/Configuration.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/Configuration.java @@ -20,8 +20,9 @@ public class Configuration public static boolean python3Extra = false; public static String rt = ""; public static String library = ""; + public static String java = Constants.JAVA_BINARY.exists() ? Constants.JAVA_BINARY.getAbsolutePath() : + Constants.JAVA_BINARY_NIX.exists() ? Constants.JAVA_BINARY_NIX.getAbsolutePath() : ""; public static String javac = ""; - public static String java = ""; public static String javaTools = ""; public static File krakatauTempDir; public static File krakatauTempJar; diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/Constants.java b/src/main/java/the/bytecode/club/bytecodeviewer/Constants.java index a4032ee3..b146fc4b 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/Constants.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/Constants.java @@ -30,6 +30,8 @@ public class Constants //TODO check if $HOME/.local/share exists, if so reference from there instead - #250 public static final File BCVDir = new File(System.getProperty("user.home") + fs + ".Bytecode-Viewer"); public static final File RT_JAR = new File(System.getProperty("java.home") + fs + "lib" + fs + "rt.jar"); + public static final File JAVA_BINARY = new File(System.getProperty("java.home") + fs + "bin" + fs + "java.exe"); + public static final File JAVA_BINARY_NIX = new File(System.getProperty("java.home") + fs + "bin" + fs + "java"); public static final File RT_JAR_DUMPED = new File(getBCVDirectory() + fs + "rt.jar"); public static final String filesName = getBCVDirectory() + fs + "recentfiles.json"; public static final String pluginsName = getBCVDirectory() + fs + "recentplugins.json";