New Bukkit Programmer Issues

Discussion in 'Plugin Development' started by BlueSin, May 11, 2012.

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

    BlueSin

    This is probably pretty straight forward, but I have followed 2 guides now and created 3 plugins all with the same issues! Essentially, I have a project named HelloWorld, a package called me.BlueSin.HelloWorld which contains one class: HelloWorld.java. My project is referencing the developer API bukkit.jar, recommended version. My project contains a plugin.yml the lines of which are:

    Code:
    name: HelloWorld
    main: me.BlueSin.HelloWorld
    version: 1.0
    My HelloWorld.java class looks like this:

    Code:
    package me.BlueSin.HelloWorld;
     
    import org.bukkit.plugin.java.JavaPlugin;
     
    public class HelloWorld extends JavaPlugin {
     
        public void onEnable() {
     
        }
     
        public void onDisable() {
     
        }
    }
    As you can see, I've stripped away all the code inside the methods and other classes and it won't even run with this basic structure! HelloWorld.jar is in the plugins folder. I am running a fresh server with the recommended version of craftbukkit, and the server log says:

    Code:
    2012-05-11 19:39:34 [SEVERE] Could not load 'plugins\HelloWorld.jar' in folder 'plugins'
    org.bukkit.plugin.InvalidPluginException: java.lang.ClassNotFoundException: me.BlueSin.HelloWorld
        at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:150)
        at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:305)
        at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:230)
        at org.bukkit.craftbukkit.CraftServer.loadPlugins(CraftServer.java:207)
        at org.bukkit.craftbukkit.CraftServer.<init>(CraftServer.java:183)
        at net.minecraft.server.ServerConfigurationManager.<init>(ServerConfigurationManager.java:53)
        at net.minecraft.server.MinecraftServer.init(MinecraftServer.java:156)
        at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:422)
        at net.minecraft.server.ThreadServerApplication.run(SourceFile:492)
    Caused by: java.lang.ClassNotFoundException: me.BlueSin.HelloWorld
        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.findClass(PluginClassLoader.java:41)
        at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:29)
        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:139)
        ... 8 more
    Also, I am using Eclipse and when I export my .jar the selected options are: Under resources: HelloWorld including the src folder are checked. Export generated class files and resources is checked, Export Java source files and resources is checked, and Compress the contents of the JAR file is checked.

    It's most likely a rookie mistake, but I am a C# developer trying to dive in to Java programming specifically to make plugins and mods. Can somebody please help me out here?

    *EDIT* Adding a link to my jar file as well, looking inside it looks a little weird which may be the problem. http://dl.dropbox.com/u/78881962/HelloWorld.zip
     
  2. Offline

    Trc202

    in you plugin.yml you say your main class is
    Code:
    me.BlueSin.HelloWorld
    but according to the source you posted it would need to be
    Code:
    me.BlueSin.HelloWorld.HelloWorld
    as the main class is in package me.BlueSin.HelloWorld and the class is called HelloWorld
     
  3. Offline

    BlueSin

    Yep rookie mistake indeed. In the tutorial it says the main line should read: <packagename>.<PluginName>, so I apparently I forgot to add the class name as well. Edited the yml and tried it out, working as intended thanks so much!
     
Thread Status:
Not open for further replies.

Share This Page