[FEATURE] Print error for unsupported Java

This commit is contained in:
Gravita 2023-09-19 16:44:09 +07:00
parent 29aee9dd30
commit 0ccef10a93

View file

@ -3,8 +3,10 @@
import pro.gravit.launcher.client.RuntimeModuleManager;
import pro.gravit.launcher.client.DirBridge;
import pro.gravit.launcher.utils.DirWatcher;
import pro.gravit.utils.Version;
import pro.gravit.utils.helper.*;
import javax.swing.*;
import java.io.IOException;
import java.nio.file.Path;
import java.util.*;
@ -92,6 +94,13 @@ public static void main(String[] arguments) throws IOException, InterruptedExcep
context.javaVersion = JavaHelper.JavaVersion.getCurrentJavaVersion();
}
if(context.javaVersion.version < 17) {
String message = String.format("GravitLauncher v%s required Java 17 or higher", Version.getVersion());
LogHelper.error(message);
JOptionPane.showMessageDialog(null, message, "GravitLauncher", JOptionPane.ERROR_MESSAGE);
System.exit(0);
}
context.executePath = IOHelper.resolveJavaBin(context.javaVersion.jvmDir);
String pathLauncher = IOHelper.getCodeSource(ClientLauncherWrapper.class).toString();
context.mainClass = "pro.gravit.launcher.LauncherEngineWrapper";