0

When I place my plugin .jar in my plugins folder and run the server, I get this error

[16:41:51] [Server thread/ERROR]: Could not load 'plugins\helloworld.jar' in folder 'plugins'
org.bukkit.plugin.InvalidPluginException: java.lang.UnsupportedClassVersionError: com/me/helloworld/Main has been compiled by a more recent version of the Java Runtime (class file version 58.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:139) ~[spigot-1.15.2.jar:git-Spigot-a99063f-be6aaf0]
at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:394) ~[spigot-1.15.2.jar:git-Spigot-a99063f-be6aaf0]
at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:301) [spigot-1.15.2.jar:git-Spigot-a99063f-be6aaf0]
at org.bukkit.craftbukkit.v1_15_R1.CraftServer.loadPlugins(CraftServer.java:353) [spigot-1.15.2.jar:git-Spigot-a99063f-be6aaf0]
at net.minecraft.server.v1_15_R1.DedicatedServer.init(DedicatedServer.java:210) [spigot-1.15.2.jar:git-Spigot-a99063f-be6aaf0]
at net.minecraft.server.v1_15_R1.MinecraftServer.run(MinecraftServer.java:784) [spigot-1.15.2.jar:git-Spigot-a99063f-be6aaf0]
at java.lang.Thread.run(Unknown Source) [?:1.8.0_221]
Caused by: java.lang.UnsupportedClassVersionError: com/me/helloworld/Main has been compiled by a more recent version of the Java Runtime (class file version 58.0), this version of the Java Runtime only recognizes class file versions up to 52.0
at java.lang.ClassLoader.defineClass1(Native Method) ~[?:1.8.0_221]
at java.lang.ClassLoader.defineClass(Unknown Source) ~[?:1.8.0_221]
at java.security.SecureClassLoader.defineClass(Unknown Source) ~[?:1.8.0_221]
at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:163) ~[spigot-1.15.2.jar:git-Spigot-a99063f-be6aaf0]
at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:96) ~[spigot-1.15.2.jar:git-Spigot-a99063f-be6aaf0]
at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_221]
at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_221]
at java.lang.Class.forName0(Native Method) ~[?:1.8.0_221]
at java.lang.Class.forName(Unknown Source) ~[?:1.8.0_221]
at org.bukkit.plugin.java.PluginClassLoader.(PluginClassLoader.java:64) ~[spigot-1.15.2.jar:git-Spigot-a99063f-be6aaf0]
at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:135) ~[spigot-1.15.2.jar:git-Spigot-a99063f-be6aaf0]
... 6 more

I compiled my plugin using the Spigot 1.15.2 jar, and my server is running on the 1.15.2 jar. I used this tutorial to build my plugin https://www.youtube.com/watch?v=MVH8cMEH0qw, and this tutorial to setup my dev server https://www.youtube.com/watch?v=Xyf0oedRRW4

Running java -version gives

java version "1.8.0_221"
Java(TM) SE Runtime Environment (build 1.8.0_221-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.221-b11, mixed mode)
JO P
  • 15
  • 3
  • Class version 58 implies Java 14. You are compiling your classes with Java 14. Check your IDEA settings (preferences & module settings). – Joachim Sauer Jul 01 '20 at 15:51
  • @JoachimSauer But isn't it good to be running on the more up to date version, shouldn't I fix the thing that only accepts version 52.0? – JO P Jul 01 '20 at 15:52
  • @JoachimSauer i.e. do I need to update my local java or something? – JO P Jul 01 '20 at 15:54
  • I updated my JRE so that `java -version` now shows "Java(TM) SE Runtime Environment (build 1.8.0_251-b08)", but I get the same error – JO P Jul 01 '20 at 15:59
  • @MarsAtomic No it does not – JO P Jul 01 '20 at 15:59
  • That's still Java 8. If you use Java 8 to run the server, you need to feed it a plugin that was compiled for Java 8. And as of JDK 11, there is no such thing as a "JRE" anymore. – RealSkeptic Jul 01 '20 at 16:09
  • @RealSkeptic I don't understand what you mean. I just downloaded Windows Offline 64 bit from https://www.java.com/en/download/manual.jsp. In IntelliJ, the project SDK is se tto "openjdk-14". I think maybe I need to change the version of java on my computer, then recompile the build tools? https://www.spigotmc.org/wiki/buildtools/. But how do I get java 14? – JO P Jul 01 '20 at 16:16
  • Actually, it does answer the question. Whether you understand it is a different matter. Take a breath and read again. – MarsAtomic Jul 01 '20 at 16:17
  • @MarsAtomic It doesn't help me, read my comments – JO P Jul 01 '20 at 16:18
  • I'm not here to argue with you. The error message is clear. The answer is clear. Comments from others are clear. If you don't want to accept the help, then, that's your decision. Good luck. – MarsAtomic Jul 01 '20 at 16:25

0 Answers0