From ae65fb8e938bd710f0a8fa915600a5332921ec71 Mon Sep 17 00:00:00 2001 From: coolGi Date: Fri, 13 Oct 2023 02:00:12 +1030 Subject: [PATCH] Attempt to find Java's binary to use for the self updater on Windows --- .../distanthorizons/core/jar/updater/SelfUpdater.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/com/seibel/distanthorizons/core/jar/updater/SelfUpdater.java b/core/src/main/java/com/seibel/distanthorizons/core/jar/updater/SelfUpdater.java index 7d0307781..d1e3b2219 100644 --- a/core/src/main/java/com/seibel/distanthorizons/core/jar/updater/SelfUpdater.java +++ b/core/src/main/java/com/seibel/distanthorizons/core/jar/updater/SelfUpdater.java @@ -311,9 +311,13 @@ public class SelfUpdater } else { + // Gets the Java binary + String javaHome = System.getProperty("java.home"); + String javaBin = javaHome + File.separator + "bin" + File.separator + "java"; + // Execute the new jar, to delete the old jar once it detects the lock has been lifted Runtime.getRuntime().exec( - "java -cp "+ + javaBin +" -cp "+ newFileLocation.getAbsolutePath() +" "+ DeleteOnUnlock.class.getCanonicalName()