mirror of
https://github.com/BX-Team/DivineMC.git
synced 2025-12-19 14:59:25 +00:00
fix console on java 22+
This commit is contained in:
@@ -34,6 +34,22 @@ public class DivineBootstrap {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void runPreBootTasks() {
|
private static void runPreBootTasks() {
|
||||||
// not required rn
|
if (getJavaVersion() > 21) {
|
||||||
|
System.setProperty("jdk.console", "java.base");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static int getJavaVersion() {
|
||||||
|
String version = System.getProperty("java.version");
|
||||||
|
if (version.startsWith("1.")) {
|
||||||
|
version = version.substring(2, 3);
|
||||||
|
} else {
|
||||||
|
int dot = version.indexOf(".");
|
||||||
|
if (dot != -1) {
|
||||||
|
version = version.substring(0, dot);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
version = version.split("-")[0];
|
||||||
|
return Integer.parseInt(version);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user