1.8.8 Cannot find main class?

Discussion in 'Spigot Plugin Development' started by Playton, Jan 25, 2020.

  1. I started trying to make a Hello World plugin for starters on making Spigot plugins. I got everything good to go, but when i put the jar file into my plugins folder and started it up, it didn't work. A log showed up in the logs that I can't decipher.

    Code (Text):
    [15:18:16] [Server thread/ERROR]: Could not load 'plugins\helloworld-1.1.4.jar' in folder 'plugins'
    org.bukkit.plugin.InvalidPluginException: Cannot find main class `me.ply.helloworld'
        at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:66) ~[spigot-1.8.8-R0.1-SNAPSHOT-latest.jar:git-Spigot-db6de12-18fbb24]
        at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:131) ~[spigot-1.8.8-R0.1-SNAPSHOT-latest.jar:git-Spigot-db6de12-18fbb24]
        at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:329) ~[spigot-1.8.8-R0.1-SNAPSHOT-latest.jar:git-Spigot-db6de12-18fbb24]
        at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:251) [spigot-1.8.8-R0.1-SNAPSHOT-latest.jar:git-Spigot-db6de12-18fbb24]
        at org.bukkit.craftbukkit.v1_8_R3.CraftServer.loadPlugins(CraftServer.java:292) [spigot-1.8.8-R0.1-SNAPSHOT-latest.jar:git-Spigot-db6de12-18fbb24]
        at net.minecraft.server.v1_8_R3.DedicatedServer.init(DedicatedServer.java:198) [spigot-1.8.8-R0.1-SNAPSHOT-latest.jar:git-Spigot-db6de12-18fbb24]
        at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:525) [spigot-1.8.8-R0.1-SNAPSHOT-latest.jar:git-Spigot-db6de12-18fbb24]
        at java.lang.Thread.run(Thread.java:748) [?:1.8.0_201]
    Caused by: java.lang.ClassNotFoundException: me.ply.helloworld
        at java.net.URLClassLoader.findClass(URLClassLoader.java:382) ~[?:1.8.0_201]
        at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:101) ~[spigot-1.8.8-R0.1-SNAPSHOT-latest.jar:git-Spigot-db6de12-18fbb24]
        at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:86) ~[spigot-1.8.8-R0.1-SNAPSHOT-latest.jar:git-Spigot-db6de12-18fbb24]
        at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[?:1.8.0_201]
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[?:1.8.0_201]
        at java.lang.Class.forName0(Native Method) ~[?:1.8.0_201]
        at java.lang.Class.forName(Class.java:348) ~[?:1.8.0_201]
        at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:64) ~[spigot-1.8.8-R0.1-SNAPSHOT-latest.jar:git-Spigot-db6de12-18fbb24]
        ... 7 more
    Help would be very much appreciated.
  2. The class you defined in your plugin.yml does not match your main class. Either try to find out yourself why that is the case or post both here.
    #2 Schottky, Jan 25, 2020
    Last edited: Jan 25, 2020
  3. SteelPhoenix


    java.lang.ClassNotFoundException: me.ply.helloworld
  4. As stated by the other, you must correctly put the main class of your plugin into the plugin.yml like this:
    Code (Text):
    main: de.jaylawl.warper.Main
    That's the main class of one of my plugins. Pretty sure that it's also case-sensitive but ff to correct me on that.
    (The main class is where you put onEnable etc)

    The exception log that you got there kind of tells you all this. Try reading into, it will help. Worst case of course you can always ask on the forums. But lots of stuff can be fixed by reading that :)
    • Agree Agree x 1
  5. Thank you! This fixed my problem. I didn't know you had to add the class as well.
    • Like Like x 1