Solved plugin.yml is unable to find main?

Discussion in 'Bukkit Help' started by Synthio, Jul 18, 2017.

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

    Synthio

    I'm having an issue with my plugin.yml, even though the main is correct, but it says it can't find my main class. I found this as I was about to test my first custom item of the plugin.

    plugin.yml:

    Code:
    name: SynthioCustomItems
    version: 1.0
    main: me.synthio.customitems.Main
    
    commands:
      thor:
        usage: /<command>
        description: Gives you Thor's Hammer.
        aliases: [hammer, thorshammer]
    Here is an image of my entire project:

    https://gyazo.com/a6be15747bf39cbea30e1c0e73f4b741


    Any help would be great. :)
     
  2. @Synthio
    Please post the error you're getting, aswell as a screenshot of the compiled jar opened with a zip program (if you haven't got one try, 7zip).
     
    Synthio likes this.
  3. Offline

    Synthio

    The Error

    Code:
    [16:44:27 ERROR]: Could not load 'plugins\CustomItems.jar' in folder 'plugins'
    org.bukkit.plugin.InvalidPluginException: Cannot find main class `me.synthio.customitems.Main'
            at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:66) ~[spigot.jar:git-Spigot-3fb9445-6e3cec8]
            at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:129) ~[spigot.jar:git-Spigot-3fb9445-6e3cec8]
            at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:329) ~[spigot.jar:git-Spigot-3fb9445-6e3cec8]
            at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:251) [spigot.jar:git-Spigot-3fb9445-6e3cec8]
            at org.bukkit.craftbukkit.v1_11_R1.CraftServer.loadPlugins(CraftServer.java:301) [spigot.jar:git-Spigot-3fb9445-6e3cec8]
            at net.minecraft.server.v1_11_R1.DedicatedServer.init(DedicatedServer.java:204) [spigot.jar:git-Spigot-3fb9445-6e3cec8]
            at net.minecraft.server.v1_11_R1.MinecraftServer.run(MinecraftServer.java:544) [spigot.jar:git-Spigot-3fb9445-6e3cec8]
            at java.lang.Thread.run(Unknown Source) [?:1.8.0_131]
    Caused by: java.lang.ClassNotFoundException: me.synthio.customitems.Main
            at java.net.URLClassLoader.findClass(Unknown Source) ~[?:1.8.0_131]
            at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:101) ~[spigot.jar:git-Spigot-3fb9445-6e3cec8]
            at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:86) ~[spigot.jar:git-Spigot-3fb9445-6e3cec8]
            at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_131]
            at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_131]
            at java.lang.Class.forName0(Native Method) ~[?:1.8.0_131]
            at java.lang.Class.forName(Unknown Source) ~[?:1.8.0_131]
            at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:64) ~[spigot.jar:git-Spigot-3fb9445-6e3cec8]
            ... 7 more
    Compiled Jar

    https://gyazo.com/d730136cdb7edf3d12e533d877c274c5


    @AlvinB if you are looking for something more specific, reply again. thanks
     
  4. @Synthio
    Woah, something is a bit wonky with your project. You're including all of craftbukkit, but not your own classes.

    To fix the CraftBukkit issue, go to the Project Structure Menu (Ctrl + Alt + Shift + S) and then Modules on the left hand side, and finally dependencies on the top tabs. Then you want to change the scope of the craftbukkit (or perhaps spigot?) jar you're compiling against to 'Provided'.

    As for why your classes aren't included, could you post a screenshot of the configuration of the artifact you use to build the jar?
     
  5. Offline

    Synthio

    Thanks for the help, here's the screenshot:

    https://gyazo.com/eb10b6af48f05d8aeaa6cee69054abb4

    @AlvinB

    Lol. looking at the artifacts image i realize what i did. haha. i removed the wrong file. thanks!

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

Share This Page