diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/game/GameDumpGenerator.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/game/GameDumpGenerator.java index 6bc32f20b9..e0adc6368f 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/game/GameDumpGenerator.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/game/GameDumpGenerator.java @@ -20,6 +20,7 @@ import com.sun.tools.attach.AttachNotSupportedException; import com.sun.tools.attach.VirtualMachine; +import org.jackhuang.hmcl.java.JavaInfo; import org.jackhuang.hmcl.util.logging.Logger; import org.jackhuang.hmcl.util.StringUtils; import org.jackhuang.hmcl.util.platform.OperatingSystem; @@ -128,7 +129,20 @@ public static void writeDumpHeadKeyValueTo(String key, String value, Writer writ } private static void writeDumpBodyTo(VirtualMachine vm, Writer writer) throws IOException { - execute(vm, "Thread.print -e -l", writer); + int vmVersion = -1; + + try { + if (vm.getSystemProperties().get("java.version") instanceof String javaVersion) + vmVersion = JavaInfo.parseVersion(javaVersion); + } catch (Throwable e) { + LOG.warning("Failed to get VM system properties", e); + } + + if (vmVersion >= 11) + execute(vm, "Thread.print -e -l", writer); + else + execute(vm, "Thread.print -l", writer); + } private static VirtualMachine attachVM(String lvmid, Writer writer) throws IOException, InterruptedException {