Loading Plugin Issue

Discussion in 'Plugin Development' started by Wailua, Dec 18, 2020.

Thread Status:
Not open for further replies.
  1. Offline

    Wailua

    Hi, I am new to Minecraft development and am trying to make a simple "hello world" type plugin to get started. My program gives me no errors. I will paste my code below.

    Main.java
    package me.wailua.OutliningUtility;
    import org.bukkit.command.Command;
    import org.bukkit.command.CommandSender;
    import org.bukkit.entity.Player;
    import org.bukkit.plugin.java.JavaPlugin;
    public class Main extends JavaPlugin {

    @Override
    public void onEnable() {

    }
    @Override
    public void onDisable() {

    }
    public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {

    if (label.equalsIgnoreCase("hello")) {
    if (sender instanceof Player) {
    Player player = (Player) sender;
    if (player.hasPermission("hello.use")) {
    player.sendMessage("Welcome to my test server");
    return true;
    }
    player.sendMessage("You do not have permission");
    return true;
    }

    else {
    sender.sendMessage("Welcome to my test server");
    return true;
    }
    }

    return false;
    }

    }

    plugin.yml
    name: OutliningUtility
    version: 1.0
    author: Wailua
    main: me.wailua.OutliningUtility.Main
    commands:
    Hello:

    Error

    When I export this plugin as a Jar file and load it into the test server and restart, the console provides the following message:

    18.12 21:48:43 [Server] ERROR Could not load 'plugins/OutliningUtility1012.jar' in folder 'plugins'

    I have made several changes to my plugin.yml file based on previous threads I have read suggesting that was the issue. None of these changes has made any difference, and I have run my plugin.yml through a yml validity checker and comes out valid.

    Any help is much appreciated!
     
  2. Offline

    timtower Administrator Administrator Moderator

    @Wailua Console also says what is wrong, so please post the full error
     
  3. Offline

    Wailua

    Code:
    19.12 20:06:20 [Server] ERROR Could not load 'plugins/OutliningUtility1012.jar' in folder 'plugins'
    19.12 20:06:20 [Server] INFO org.bukkit.plugin.InvalidPluginException: java.lang.UnsupportedClassVersionError: me/wailua/OutliningUtility/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
    19.12 20:06:20 [Server] INFO at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:133) ~[spigot_1.12.2.jar:git-Spigot-79a30d7-acbc348]
    19.12 20:06:20 [Server] INFO at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:327) ~[spigot_1.12.2.jar:git-Spigot-79a30d7-acbc348]
    19.12 20:06:20 [Server] INFO at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:248) [spigot_1.12.2.jar:git-Spigot-79a30d7-acbc348]
    19.12 20:06:20 [Server] INFO at org.bukkit.craftbukkit.v1_12_R1.CraftServer.loadPlugins(CraftServer.java:305) [spigot_1.12.2.jar:git-Spigot-79a30d7-acbc348]
    19.12 20:06:20 [Server] INFO at net.minecraft.server.v1_12_R1.DedicatedServer.init(DedicatedServer.java:205) [spigot_1.12.2.jar:git-Spigot-79a30d7-acbc348]
    19.12 20:06:20 [Server] INFO at net.minecraft.server.v1_12_R1.MinecraftServer.run(MinecraftServer.java:545) [spigot_1.12.2.jar:git-Spigot-79a30d7-acbc348]
    19.12 20:06:20 [Server] INFO at java.lang.Thread.run(Thread.java:748) [?:1.8.0_262]
    19.12 20:06:20 [Server] INFO Caused by: java.lang.UnsupportedClassVersionError: me/wailua/OutliningUtility/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
    19.12 20:06:20 [Server] INFO at java.lang.ClassLoader.defineClass1(Native Method) ~[?:1.8.0_262]
    19.12 20:06:20 [Server] INFO at java.lang.ClassLoader.defineClass(ClassLoader.java:756) ~[?:1.8.0_262]
    19.12 20:06:20 [Server] INFO at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) ~[?:1.8.0_262]
    19.12 20:06:20 [Server] INFO at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:148) ~[spigot_1.12.2.jar:git-Spigot-79a30d7-acbc348]
    19.12 20:06:20 [Server] INFO at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:100) ~[spigot_1.12.2.jar:git-Spigot-79a30d7-acbc348]
    19.12 20:06:20 [Server] INFO at java.lang.ClassLoader.loadClass(ClassLoader.java:418) ~[?:1.8.0_262]
    19.12 20:06:20 [Server] INFO at java.lang.ClassLoader.loadClass(ClassLoader.java:351) ~[?:1.8.0_262]
    19.12 20:06:20 [Server] INFO at java.lang.Class.forName0(Native Method) ~[?:1.8.0_262]
    19.12 20:06:20 [Server] INFO at java.lang.Class.forName(Class.java:348) ~[?:1.8.0_262]
     
    Last edited by a moderator: Dec 20, 2020
  4. Offline

    timtower Administrator Administrator Moderator

    @Wailua You are compiling with something else than java 8, that is causing this issue.
     
  5. Offline

    Wailua

    That resolved it. Thank you for your help!
     
Thread Status:
Not open for further replies.

Share This Page