3
0
mirror of https://github.com/Qortal/qortal.git synced 2025-02-12 18:25:49 +00:00

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.
This commit is contained in:
catbref 2020-03-11 10:41:39 +00:00
parent 9db606af5a
commit b0b0e2ac18

View File

@ -231,6 +231,10 @@ public class AutoUpdate extends Thread {
// JVM arguments // JVM arguments
javaCmd.addAll(ManagementFactory.getRuntimeMXBean().getInputArguments()); 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 // Call ApplyUpdate using new JAR
javaCmd.addAll(Arrays.asList("-cp", NEW_JAR_FILENAME, ApplyUpdate.class.getCanonicalName())); javaCmd.addAll(Arrays.asList("-cp", NEW_JAR_FILENAME, ApplyUpdate.class.getCanonicalName()));