Could not load plugin

Discussion in 'Plugin Development' started by krystianwiechec, Aug 17, 2020.

Thread Status:
Not open for further replies.
  1. Hey, I wanted to create a plugin but I get this error in the console:
    Code:
    [18:52:26] [Server thread/WARN]: Legacy plugin DumbPlugin v1.0.0 does not specify an api-version.
    [18:52:26] [Server thread/ERROR]: Could not load 'plugins\DumbPlugin.jar' in folder 'plugins'
    org.bukkit.plugin.InvalidPluginException: java.lang.UnsupportedClassVersionError: com/github/krystianwiechec/DumbPlugin/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:139) ~[spigot-1.16.2.jar:git-Spigot-379750e-43c7ff9]
            at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:394) ~[spigot-1.16.2.jar:git-Spigot-379750e-43c7ff9]
            at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:301) ~[spigot-1.16.2.jar:git-Spigot-379750e-43c7ff9]
            at org.bukkit.craftbukkit.v1_16_R2.CraftServer.loadPlugins(CraftServer.java:381) ~[spigot-1.16.2.jar:git-Spigot-379750e-43c7ff9]
            at net.minecraft.server.v1_16_R2.DedicatedServer.init(DedicatedServer.java:186) ~[spigot-1.16.2.jar:git-Spigot-379750e-43c7ff9]
            at net.minecraft.server.v1_16_R2.MinecraftServer.w(MinecraftServer.java:808) ~[spigot-1.16.2.jar:git-Spigot-379750e-43c7ff9]
            at net.minecraft.server.v1_16_R2.MinecraftServer.lambda$0(MinecraftServer.java:164) ~[spigot-1.16.2.jar:git-Spigot-379750e-43c7ff9]
            at java.lang.Thread.run(Unknown Source) [?:1.8.0_261]
    Caused by: java.lang.UnsupportedClassVersionError: com/github/krystianwiechec/DumbPlugin/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 java.lang.ClassLoader.defineClass1(Native Method) ~[?:1.8.0_261]
            at java.lang.ClassLoader.defineClass(Unknown Source) ~[?:1.8.0_261]
            at java.security.SecureClassLoader.defineClass(Unknown Source) ~[?:1.8.0_261]
            at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:163) ~[spigot-1.16.2.jar:git-Spigot-379750e-43c7ff9]
            at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:96) ~[spigot-1.16.2.jar:git-Spigot-379750e-43c7ff9]
            at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_261]
            at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_261]
            at java.lang.Class.forName0(Native Method) ~[?:1.8.0_261]
            at java.lang.Class.forName(Unknown Source) ~[?:1.8.0_261]
            at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:64) ~[spigot-1.16.2.jar:git-Spigot-379750e-43c7ff9]
            at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:135) ~[spigot-1.16.2.jar:git-Spigot-379750e-43c7ff9]
            ... 7 more
    my Main class looks like this:
    Code:
    package com.github.krystianwiechec.DumbPlugin.main;
    import org.bukkit.plugin.java.JavaPlugin;
    
    public class Main extends JavaPlugin {
    
    @Override
    public void onEnable() { }
    
    @Override
    public void onDisable() {}
    
    }
    and plugin.yml like this:
    Code:
    name: DumbPlugin
    main: com.github.krystianwiechec.DumbPlugin.main.Main
    version: 1.0.0
    description: This plugin is dumb
    Anyone know why is getting this error?
     
    Last edited by a moderator: Aug 17, 2020
  2. Online

    timtower Administrator Administrator Moderator

    @krystianwiechec You are compiling with java a lot while the server is running java 8
     
  3. Ok, so what do I have to do to make it work?
     
  4. Online

    timtower Administrator Administrator Moderator

    Compile with java 8
     
Thread Status:
Not open for further replies.

Share This Page