InvalidPluginException: ClassNotFoundException

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

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

    er0d

    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:

    Untitled.png

    ---
    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:

    Code:
    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.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:184)
            at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:306)
            at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:230)
            at org.bukkit.craftbukkit.v1_6_R2.CraftServer.loadPlugins(CraftServer.java:243)
            at net.minecraft.server.v1_6_R2.DedicatedServer.init(DedicatedServer.java:117)
            at net.minecraft.server.v1_6_R2.MinecraftServer.run(MinecraftServer.java:397)
            at net.minecraft.server.v1_6_R2.ThreadServerApplication.run(SourceFile:582)
    Caused by: java.lang.ClassNotFoundException: ModTest.ModTest
            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.findClass0(PluginClassLoader.java:80)
            at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:53)
            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:173)
            ... 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

    etaxi341

    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

    ShadowLAX

    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

    MuisYa

    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. Offline

    er0d

    Hi,

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

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

    But I still have the error:
    :'(

    another idea?
     
  6. Offline

    MuisYa

    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. Offline

    er0d

    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

    Dpasi314

    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

    MuisYa


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

    ccrama

    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

    The_Doctor_123

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

    ccrama

    @The_Doctor_123
    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