InvalidPluginException: ClassNotFoundException

Discussion in 'Plugin Development' started by er0d, Jul 24, 2013.

Thread Status:
Not open for further replies.
  1. Hi,

    I'm trying to create a plugin for my server. I'm at the beginning of the process. I just made a class that extends JavaPlugin and put some logs in onEnable and on Disable methods:

    View attachment 14394

    plugin.yml file contains only the 3 required fields:

    main: ModTest.ModTest
    name: 'ModTest'
    version: '0.0.1'

    When I launch the mc server, I got the following logs:

    17:13:10 [SEVERE] Could not load 'plugins\modtest.jar' in folder 'plugins'
    org.bukkit.plugin.InvalidPluginException: java.lang.ClassNotFoundException: ModTest.ModTest
            at org.bukkit.plugin.SimplePluginManager.loadPlugin(
            at org.bukkit.plugin.SimplePluginManager.loadPlugins(
            at org.bukkit.craftbukkit.v1_6_R2.CraftServer.loadPlugins(
            at net.minecraft.server.v1_6_R2.DedicatedServer.init(
    Caused by: java.lang.ClassNotFoundException: ModTest.ModTest
            at$ Source)
            at$ Source)
            at Method)
            at Source)
            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)
            ... 6 more
    I'm on windows 7 64 bits. I'm using the last version of eclipse and the last version of spigot.

    Somebody have an idea of what I am doing wrong?
  2. Offline


    Try to rename your package in something like me.er0d.modtest and test it then again. I think there is something wrong with your package.
  3. Offline


    In the plugin.yml, your "Main" has to include the package name as well as your Main class.

    You package name should always have at least 3 things.Change your package name to me.<YourMinecraftUsername>.<PluginName>

    Then in the plugin.yml use the package name and at the end add .<MainClass>

    So in this case it would be me.<YourMCName>.modtest.ModTest

    Remove the <> from them, I just did that to define them as separate. If you have a website or something like that, you can use com or net at the beginning, I'm not quite sure of what defines com and net.

    Also, Don't use Capitals in your package's names. Hope this helps!
  4. Offline


    I don't know what the problem here is exactly, but first try following the Java syntax guidelines on packages.
    This syntax states that package names should always be lower case.
  5. Hi,

    thanks a lot for your help.
    I tried to rename the package like this:

    Then I modified plugin.yml's main markup:
    main: me.erod.modtest.ModTest

    But I still have the error:

    another idea?
  6. Offline


    Export your plugin, and open it with Winrar or a similar program and check what folders you go through before you reach your class inside of it.

    Please list the folders you go through.
  7. Hum... There is only the plugin.yml file and META-INF folder in the archive -.-
    I do not manage to understand wy the compiled class is not in there :/
  8. Offline


    Are you using Spigot on a Bukkit server? I'm not sure that, that will work.
    I say that because I see i your referenced library you're using Spigot.jar, not sure if you also have Craftbukkit in there.
  9. Offline


    Can you hit export on your project, and then make a screenshot what is pre-selected?
  10. Offline


    I know this is an old thread, but I had that problem when I had plugin.yml selected when I exported. Making sure to click on the main folder before exporting fixed it for me!
  11. Offline


    Woo hoo! Revived thread! The OP is long gone now.
  12. Offline


    Yeah, understand that. Just for others to see if they are having the same issue!
Thread Status:
Not open for further replies.

Share This Page