Solved UnsupportedClassVersionError

Discussion in 'Spigot Plugin Development' started by 4Died9_Hi, Feb 23, 2020.

  1. Please everyone I got mad... I watched many threads about this error on the Internet but still can't solve it. I am using the following:

    JDK: 13.0.2
    JRE: 1.8
    Spigot: 1.12.2

    I had heard of that this is an "extremely common errors", but yea I just hadn't met this before when I was coding plugins..
    Please guys. Thanks a lot

    Error Code:
    Code (Text):
    Could not load 'plugins\FirstPlugin.jar' in folder 'plugins'
    org.bukkit.plugin.InvalidPluginException: java.lang.UnsupportedClassVersionError: com/stephen/plugin/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:131) ~[spigot.jar:git-Paper-1618]
            at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:329) ~[spigot.jar:git-Paper-1618]
            at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:251) ~[spigot.jar:git-Paper-1618]
            at org.bukkit.craftbukkit.v1_12_R1.CraftServer.loadPlugins(CraftServer.java:318) ~[spigot.jar:git-Paper-1618]
            at net.minecraft.server.v1_12_R1.DedicatedServer.init(DedicatedServer.java:222) ~[spigot.jar:git-Paper-1618]
            at net.minecraft.server.v1_12_R1.MinecraftServer.run(MinecraftServer.java:616) ~[spigot.jar:git-Paper-1618]
            at java.lang.Thread.run(Unknown Source) [?:1.8.0_241]
    Caused by: java.lang.UnsupportedClassVersionError: com/stephen/plugin/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 java.lang.ClassLoader.defineClass1(Native Method) ~[?:1.8.0_241]
            at java.lang.ClassLoader.defineClass(Unknown Source) ~[?:1.8.0_241]
            at java.security.SecureClassLoader.defineClass(Unknown Source) ~[?:1.8.0_241]
            at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:152) ~[spigot.jar:git-Paper-1618]
            at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:104) ~[spigot.jar:git-Paper-1618]
            at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_241]
            at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_241]
            at java.lang.Class.forName0(Native Method) ~[?:1.8.0_241]
            at java.lang.Class.forName(Unknown Source) ~[?:1.8.0_241]
            at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:82) ~[spigot.jar:git-Paper-1618]
            at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:127) ~[spigot.jar:git-Paper-1618]
            ... 6 more
     
  2. Hey the error here is stating that the plugin was compiled with a higher version of java than the server can allow. If you are the creator of the plugin then use an older version of java to compile your plugin.

    Hopes this helps, there are lots of links through google to help you with this problem in different ides/environments
     
  3. Ok I am even mad now.. To who may feel mad also:
    If you code with eclipse and meet this error. Configure your build path, edit the modulepath 'JRE', change it to JRE 8 and it's alright
    Sorry for posting trash
    Thank you Lorinthio anyway :)
     
    • Informative Informative x 1
  4. IntelliJ is my go to since I had so many environmental type issues and build issues with Eclipse.

    Happy coding!
     
    • Agree Agree x 1