Minecraft] Server error starting?

Ba
- in Plugins
11

The mistake

Could not load 'plugins \ Zu2weit-1.16.jar' in folder 'plugins'
org.bukkit.plugin.InvalidPluginException: java.lang.UnsupportedClassVersionError: Main / main has been compiled by a more recent version of the Java Runtime (class file version 57.0), this version of the Java Runtime only recognizes class file versions up to 52.0
at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin (JavaPluginLoader.java:141) ~ [patched_1.16.3.jar: git-Paper-246]
at org.bukkit.plugin.SimplePluginManager.loadPlugin (SimplePluginManager.java:397) ~ [patched_1.16.3.jar: git-Paper-246]
at org.bukkit.plugin.SimplePluginManager.loadPlugins (SimplePluginManager.java:305) ~ [patched_1.16.3.jar: git-Paper-246]
at org.bukkit.craftbukkit.v1_16_R2.CraftServer.loadPlugins (CraftServer.java:389) ~ [patched_1.16.3.jar: git-Paper-246]
at net.minecraft.server.v1_16_R2.DedicatedServer.init (DedicatedServer.java:204) ~ [patched_1.16.3.jar: git-Paper-246]
at net.minecraft.server.v1_16_R2.MinecraftServer.w (MinecraftServer.java:939) ~
[…]

according to research, seems to be not exactly unknown. I keep reading answers about "the server is on Java8 and something else on a higher / lower version". Unfortunately, I haven't seen how to fix it.

So… How can I fix this? Today I updated my Java apps on my PC and uninstalled jre8u271 because otherwise I would not have been able to install another IDE. Java SE Development Kit 8 Update 271 and Java (TM) SE Development Kit 15.0.1 are currently installed. The server runs on the 1.16.3 PaperSpigot-246 and was not "updated" to 249 after updating the Java apps.

Re

The error message is crystal clear: Something was compiled for Java 13, but the process ("server") only runs on Java 8.

Java is very backward compatible: newer versions can execute code for any older version. But not the other way around.

There are now two options:

The plugin has to be recompiled for Java 8. This is usually not a problem at all because the typical Minecraft developer has hardly mastered the features of Java 8, let alone uses newer ones. It's just a setting when building the plugin. Or,
The process must also be run with Java 13 or a higher version.

Ba

Couldn't I just have the JDK15.0.1 and an older one installed? Because everyone has problems with new mistakes. No matter how long it takes. Or what do you think is the best solution? Because I understand you, but not what exactly I should do😅

Re

You can have whatever you want installed. 20 different JDKs, that's fine with Java (in contrast to Python…).

The only decisive factor here is what the server is operated with and what your plug-in was compiled for.

Since you are apparently the developer of this plugin yourself: set the JDK for this project to one of version 8, then build it again, done.

Ba

The problem only arose when I updated my Java apps and threw down Java8u271🤔 OK, I'll try Java15 and Java13

Re

* sigh *

Again: you (yes, you) built the plugin for the wrong target version. That doesn't happen by itself, and there's no point in installing versions 13, 15 or 16 haphazardly.

The solution is very simple (in Eclipse it should be about 5 mouse clicks), but you have to build your plugin again yourself, with the correct target version.

Ba

I'm doing this in IntelliJ right now, but I'll just create a new project and rewrite everything. Copying the code shouldn't matter.

Ba

I think I have the solution without trying it. You can specify the Project SDK at IntelliJ, I beginner xD

Ba

OK, I'm a beginner after all… -.-

I have now copied the entire project into the SDK15 and the PC has the SDK. Same mistake… Or does it have to be SDK13?

Re

You don't have to copy your project, create a new one or anything. All you have to do is change the JDK used. Project Structure - and use the JDK version 8 there (you can also build with a newer JDK for an older one, but this is prone to errors). Finished.

Ba

I did it now. I have to uninstall Java 8 again so that I can start Eclipse again to export the projects, but what the heck. It's so stupid that I can't use Eclipse and localhost at the same time… Or am I doing something wrong again

Ba

Eh, it works like that now. WTF