From e894c4d08cd45b6d26726c4eae86c413dd692993 Mon Sep 17 00:00:00 2001 From: CraftBukkit/Spigot Date: Sat, 3 Jun 2023 11:39:00 +1000 Subject: [PATCH] #1191: Do not start on pre-release Java 17 Pre-release versions of Java may miss standard API that is introduced later during development of the same release. Unfortunately some server hosts knowingly (!) run these versions in production, even years after the general availability of that java release. Therefore, we need to manually enforce that the server only runs on fully standardized versions to ensure compatibility of plugin and server code with the runtime. To cause less problems when developers test their software with newer Java, this rule is only enforced on the oldest Java release the server can run with. This is the Java version all plugins will normally compile to, so it's feature set must always be available during runtime. By: saltyaimbotter --- .../src/main/java/org/bukkit/craftbukkit/Main.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/Main.java b/paper-server/src/main/java/org/bukkit/craftbukkit/Main.java index ed7b3b6e20..66a6a0bd40 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/Main.java @@ -169,6 +169,13 @@ public class Main { System.err.println("Unsupported Java detected (" + javaVersion + "). Only up to Java 20 is supported."); return; } + String javaVersionName = System.getProperty("java.version"); + // J2SE SDK/JRE Version String Naming Convention + boolean isPreRelease = javaVersionName.contains("-"); + if (isPreRelease && javaVersion == 61.0) { + System.err.println("Unsupported Java detected (" + javaVersionName + "). You are running an outdated, pre-release version. Only general availability versions of Java are supported. Please update your Java version."); + return; + } try { // This trick bypasses Maven Shade's clever rewriting of our getProperty call when using String literals