From b0b0e2ac18c97ed286f5d936e74aa2ffa7cce2bd Mon Sep 17 00:00:00 2001 From: catbref Date: Wed, 11 Mar 2020 10:41:39 +0000 Subject: [PATCH] Strip JNI options before calling ApplyUpdate AdvancedInstaller's Java launcher EXE seems to use JNI to launch the JAR, instead of using the command-line 'java' binary directly. When AI's launcher does this, it adds options like "abort" and "exit", along with corresponding hook addresses. These options are returned by the call to ManagementFactory.getRuntimeMXBean().getInputArguments() which is done in AutoUpdate while building the command line for launching ApplyUpdate. Because command-line 'java' binary doesn't support these options, they are now stripped out. --- src/main/java/org/qortal/controller/AutoUpdate.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/org/qortal/controller/AutoUpdate.java b/src/main/java/org/qortal/controller/AutoUpdate.java index 21c7ecc0..e1a445fe 100644 --- a/src/main/java/org/qortal/controller/AutoUpdate.java +++ b/src/main/java/org/qortal/controller/AutoUpdate.java @@ -231,6 +231,10 @@ public class AutoUpdate extends Thread { // JVM arguments javaCmd.addAll(ManagementFactory.getRuntimeMXBean().getInputArguments()); + // Remove JNI options as they won't be supported by command-line 'java' + // These are typically added by the AdvancedInstaller Java launcher EXE + javaCmd.removeAll(Arrays.asList("abort", "exit", "vfprintf")); + // Call ApplyUpdate using new JAR javaCmd.addAll(Arrays.asList("-cp", NEW_JAR_FILENAME, ApplyUpdate.class.getCanonicalName()));