Plugin Help 'Cannot find main class'

Discussion in 'Plugin Help/Development/Requests' started by nathanthesnooper, Apr 15, 2017.

Thread Status:
Not open for further replies.
  1. Solved by @Zombie_Striker

    As the comment in the code says, if I include
    Code:
    getLogger().info("This does not show in console!");
    in the code, I get an error, but if it isn't there, there is no error? It is a bug because I am not changing anything about the plugin.yml, but the error says that it is the problem.

    Error (open)

    Code:
    [23:03:38 ERROR]: Could not load 'plugins/BetterWands_1-25.jar' in folder 'plugins'
    org.bukkit.plugin.InvalidPluginException: Cannot find main class `me.nathanthesnooper.BetterWands'
        at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:66) ~[svrstart.jar:git-Spigot-db6de12-18fbb24]
        at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:131) ~[svrstart.jar:git-Spigot-db6de12-18fbb24]
        at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:329) ~[svrstart.jar:git-Spigot-db6de12-18fbb24]
        at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:251) [svrstart.jar:git-Spigot-db6de12-18fbb24]
        at org.bukkit.craftbukkit.v1_8_R3.CraftServer.loadPlugins(CraftServer.java:292) [svrstart.jar:git-Spigot-db6de12-18fbb24]
        at net.minecraft.server.v1_8_R3.DedicatedServer.init(DedicatedServer.java:198) [svrstart.jar:git-Spigot-db6de12-18fbb24]
        at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:525) [svrstart.jar:git-Spigot-db6de12-18fbb24]
        at java.lang.Thread.run(Thread.java:745) [?:1.8.0_121]
    Caused by: java.lang.ClassNotFoundException: me.nathanthesnooper.BetterWands
        at java.net.URLClassLoader.findClass(URLClassLoader.java:381) ~[?:1.8.0_121]
        at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:101) ~[svrstart.jar:git-Spigot-db6de12-18fbb24]
        at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:86) ~[svrstart.jar:git-Spigot-db6de12-18fbb24]
        at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[?:1.8.0_121]
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[?:1.8.0_121]
        at java.lang.Class.forName0(Native Method) ~[?:1.8.0_121]
        at java.lang.Class.forName(Class.java:348) ~[?:1.8.0_121]
        at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:64) ~[svrstart.jar:git-Spigot-db6de12-18fbb24]
        ... 7 more
    


    BetterWands.java (open)

    Code:
    package me.nathanthesnooper;
    
    import org.bukkit.plugin.java.JavaPlugin;
    
    public class BetterWands extends JavaPlugin {
     
        @Override
        public void onEnable () {
            /*
             *
             * With: Crash; Without: Fine :/
             * getLogger().info("This does not show in console!");
             *
             */
        }
    
        @Override
        public void onDisable () {
         
        }
     
    }
    
     
    Last edited: Apr 15, 2017
  2. Offline

    Zombie_Striker

    First, why are you on 1.8? Please read this.

    Are you sure you are exporting the class files? Try opening your jar file and see if the .class file exists.
     
  3. @Zombie_Striker Thank you! I checked the class files, and they weren't there. I noticed that because I put my builds folder in eclipse, it probably mixed something up... When I moved my builds folder, the classes were there, and everything is now working! :) I feel like an idiot now...
     
Thread Status:
Not open for further replies.

Share This Page