Can't get plugin to load

Discussion in 'Plugin Development' started by kag359six, Jun 22, 2012.

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

    kag359six

    I keep getting an error saying [SEVERE] could not load 'plugins\MinecraftPlugin.jar' in folder 'plugins'All im trying to do is write a simple plugin that tells me when the plugin is enabled and disabled. Heres code:

    Code:
    package com.gmail.frantic;
    import java.util.logging.Logger;
    import org.bukkit.plugin.*;
     
    import org.bukkit.plugin.java.JavaPlugin;
     
    public class MinecraftPlugin extends JavaPlugin {
     
        Logger log = Logger.getLogger("Minecraft");
     
        public void onEnabled() {
       
            log.info("Plugin test enabled");
       
        }
     
        public void onDisabled() {
       
            log.info("the plugin is Disabled!!!");
       
        }
     
    }
    
    Here's what my yml file looks like:

    name: MinecraftPlugin

    main: com.gmail.frantic.MinecraftPlugin

    version: 1.2.5
     
    MrEinStain likes this.
  2. Offline

    MucTweezer

    Now I might be completely off base here, but the problem would seem to me to be: onEnable() and onDisable() must be named exactly that, not onEnabled() and onDisabled().

    I'm thinking you're getting this error because it cannot find an onEnable() to call.
     
  3. Offline

    JxAxVxAx

    Heres A Good Fix


    Code:
    package com.gmail.frantic;
    import java.util.logging.Logger;
    import org.bukkit.plugin.*;
     
    import org.bukkit.plugin.java.JavaPlugin;
     
    public class MinecraftPlugin extends JavaPlugin {
     
        public Logger log = Logger.getLogger("Minecraft");
     
        public void onEnable() {
     
            this.log.info("Plugin test enabled");
     
        }
     
        public void onDisable() {
     
            this.log.info("the plugin is Disabled!!!");
     
        }
     
    }
     
  4. Offline

    kag359six

    hi thanks for reply, but it's still giving me that error. Is there maybe some specific place that the folders have to be? I'm not sure. i have everything in one folder called Bukkit Server in my Appdata folder where minecraft is installed.
     
  5. I think it woulld be usefull if we see the error, so we know what it your problem, is this your logic to?
     
  6. Offline

    MrDent009

    Here:
    Code:
       
    private static final Logger log = Logger.getLogger("Minecraft");
     
    public void onEnable() {
            PluginDescriptionFile pdfFile = this.getDescription();
            this.log.info(pdfFile.getName() + " version " + pdfFile.getVersion() + " is now enabled.");
     
        }
        public void onDisable() {
            PluginDescriptionFile pdfFile = this.getDescription();
            this.log.info(pdfFile.getName() + " version " + pdfFile.getVersion() + " is now disabled.");
        }
        
    Problem solved :)
     
  7. Offline

    kag359six

    Sorry but it still didn't work. :( I dont get it.

    Code:
    2012-06-26 11:23:03 [INFO] Starting minecraft server version 1.2.5
    2012-06-26 11:23:03 [INFO] Loading properties
    2012-06-26 11:23:03 [WARNING] server.properties does not exist
    2012-06-26 11:23:03 [INFO] Generating new properties file
    2012-06-26 11:23:03 [INFO] Starting Minecraft server on *:25565
    2012-06-26 11:23:03 [INFO] This server is running CraftBukkit version git-Bukkit-1.2.5-R4.0-b2222jnks (MC: 1.2.5) (Implementing API version 1.2.5-R4.0)
    2012-06-26 11:23:03 [WARNING] Failed to load ban list: java.io.FileNotFoundException: banned-players.txt (The system cannot find the file specified)
    2012-06-26 11:23:03 [WARNING] Failed to load ip ban list: java.io.FileNotFoundException: banned-ips.txt (The system cannot find the file specified)
    2012-06-26 11:23:03 [WARNING] Failed to load operators list: java.io.FileNotFoundException: ops.txt (The system cannot find the file specified)
    2012-06-26 11:23:03 [WARNING] Failed to load white-list: java.io.FileNotFoundException: white-list.txt (The system cannot find the file specified)
    2012-06-26 11:23:03 [INFO] Preparing level "world"
    2012-06-26 11:23:03 [INFO] Default game type: 0
    2012-06-26 11:23:03 [INFO] Preparing start region for level 0 (Seed: -4220373416939270332)
    2012-06-26 11:23:04 [INFO] Preparing start region for level 1 (Seed: -4220373416939270332)
    2012-06-26 11:23:04 [INFO] Preparing start region for level 2 (Seed: -4220373416939270332)
    2012-06-26 11:23:04 [INFO] Done (0.993s)! For help, type "help" or "?"
    2012-06-26 11:23:38 [INFO] 182 recipes
    2012-06-26 11:23:38 [INFO] Server permissions file permissions.yml is empty, ignoring it
    2012-06-26 11:23:38 [INFO] [32;1mReload complete.[m
    2012-06-26 11:24:18 [INFO] Starting minecraft server version 1.2.5
    2012-06-26 11:24:18 [INFO] Loading properties
    2012-06-26 11:24:18 [INFO] Starting Minecraft server on *:25565
    2012-06-26 11:24:18 [INFO] This server is running CraftBukkit version git-Bukkit-1.2.5-R4.0-b2222jnks (MC: 1.2.5) (Implementing API version 1.2.5-R4.0)
    2012-06-26 11:24:18 [SEVERE] Could not load 'plugins\MinecraftPlugin.jar' in folder 'plugins'
    org.bukkit.plugin.InvalidPluginException: java.lang.ClassNotFoundException: com.gmail.frantic.MinecraftPlugin
        at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:151)
        at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:305)
        at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:230)
        at org.bukkit.craftbukkit.CraftServer.loadPlugins(CraftServer.java:213)
        at org.bukkit.craftbukkit.CraftServer.<init>(CraftServer.java:189)
        at net.minecraft.server.ServerConfigurationManager.<init>(ServerConfigurationManager.java:53)
        at net.minecraft.server.MinecraftServer.init(MinecraftServer.java:166)
        at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:432)
        at net.minecraft.server.ThreadServerApplication.run(SourceFile:492)
    Caused by: java.lang.ClassNotFoundException: com.gmail.kag359six.MinecraftPlugin
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:41)
        at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:29)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Unknown Source)
        at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:140)
    I posted the error

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 26, 2016
  8. Offline

    bitWolfy

    The error log says that you are using com.gmail.kag359six package, while your code says com.gmail.frantic Maybe, that's the problem?
     
  9. Offline

    Codex Arcanum

    Do you have your main class selected correctly in your plugin.yml?
     
  10. Offline

    kag359six

    no it isnt i changed the email when posting for safety reasons but too late now lol. I'll change it

    All I know is that there are others with the same question but nobody has been able to answer them. I'm starting to wonder if it has something to do with compatability, but I tried it on my desktop and laptop and it does the same thing.

    Yeah i believe so, the yml is on the first post of this thread.

    I GOT IT OH MY GOD HOURS AND HOURS OF WORK. Ok, for the many others having similar issues, heres the answer in my case. For the yml file, i put "com.gmail.frantic.MinecraftPlugin" For the main class part under "main". The bukkit tutorials suggest naming the plugin the same as the main class, so i did that. It also says to name the package as <packagename>.<mainclassname> and i did that too, however that lead to confusion, since i also had to add another period after under the main class. So instead of "com.gmail.frantic.MinecraftPlugin" it should be "com.gmail.frantic.MinecraftPlugin.MinecraftPlugin". The first MinecraftPlugin references the package itself, and the second references the class, hence, the error with finding the class MinecraftPlugin in the first place. THANKS A BUNCH EVERYBODY.

    Your question helped me find the resolution to the problem. I should blow you right now.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 26, 2016
Thread Status:
Not open for further replies.

Share This Page