Solved PircBot - How to install/import?

Discussion in 'Plugin Development' started by Zumpz, Mar 1, 2013.

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

    Zumpz

    Hello, I'm trying to install/import PircBot. PircBot is in Referenced Libraries.
    I use Eclipse Classic for Mac.
    How can I import this on the simplest and best way? I'm noob at this :-P
    Error:
    Show Spoiler

    org.bukkit.plugin.InvalidPluginException: java.lang.NoClassDefFoundError: org/jibble/pircbot/NickAlreadyInUseException
    at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:184)
    at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:305)
    at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:230)
    at org.bukkit.craftbukkit.v1_4_R1.CraftServer.loadPlugins(CraftServer.java:239)
    at org.bukkit.craftbukkit.v1_4_R1.CraftServer.reload(CraftServer.java:594)
    at org.bukkit.Bukkit.reload(Bukkit.java:184)
    at org.bukkit.command.defaults.ReloadCommand.execute(ReloadCommand.java:23)
    at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:186)
    at org.bukkit.craftbukkit.v1_4_R1.CraftServer.dispatchCommand(CraftServer.java:514)
    at org.bukkit.craftbukkit.v1_4_R1.CraftServer.dispatchServerCommand(CraftServer.java:506)
    at net.minecraft.server.v1_4_R1.DedicatedServer.al(DedicatedServer.java:260)
    at net.minecraft.server.v1_4_R1.DedicatedServer.r(DedicatedServer.java:225)
    at net.minecraft.server.v1_4_R1.MinecraftServer.q(MinecraftServer.java:494)
    at net.minecraft.server.v1_4_R1.MinecraftServer.run(MinecraftServer.java:427)
    at net.minecraft.server.v1_4_R1.ThreadServerApplication.run(SourceFile:849)
    Caused by: java.lang.NoClassDefFoundError: org/jibble/pircbot/NickAlreadyInUseException
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:247)
    at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:173)
    ... 14 more
    Caused by: java.lang.ClassNotFoundException: org.jibble.pircbot.NickAlreadyInUseException
    at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    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(ClassLoader.java:306)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
    ... 17 more
     
  2. Offline

    AmShaegar

    How did you try it? NickAlreadyInUseException should be self-explanatory. I am using PircBot and Bukkit but I never had the idea to combine them ^^
     
  3. Offline

    -_Husky_-

    Code:
    java.lang.NoClassDefFoundError:
    means there is no class called NickAlreadyInUseException
     
  4. Offline

    AmShaegar

    Oh damn, sorry :rolleyes: That was really stupid. Ignore my last post. I should go to bed. It's 3:30 am over here ^^

    Anyway, usually, you have to extend the PircBot class.
    Code:
    public class IRCBot extends PircBot { ... }
    You have to reference pircbot.jar by right-clicking your project, build path, add external archives...
     
  5. gomeow and zack6849 like this.
  6. Offline

    gomeow

  7. Offline

    Zumpz

    Okay, I switched to PircBotX, but get the same error. My question: How can I install/import it.. I have import PircBotX same as Bukkit, in Referenced Libraries.
     
  8. Offline

    AmShaegar

    Okay, I tried it by mayself now and you are right. It is not that simple. Suprisingly I did not manage to get it to work :-(

    The problem is, that your referenced .jar is never loaded because your plugin does not do that. The main method is in craftbukkit which does not know you need that lib. What you need to do is either load in your code or make craftbukkit load/find it. I did not make it in the first try but you might be more lucky.

    http://forums.bukkit.org/threads/load-external-jar-causes-noclassdeffound.111497/

    Maybe importing the sources instead is what you want. Everything should be automatically included in your plugin.
     
  9. you need to get the jar inside the classpath of the server, or you need to chance the startup script so they are included, or place the files inside your jar file
     
  10. Offline

    Zumpz

    Okay, my newest problem now: Where is the META-INF or MANIFEST file? I can't find it. And when I tried to open the file (the project, -> Plug-in tools -> Open manifest), It said "Cannot find manifest for the current selection."
     
  11. Offline

    AmShaegar

    Finally, I got a solution for you.

    • Export your plugin -> Choose jar file -> click next to last page -> check "Generate manifest file" and "Save in the workspace"
    • Edit the maifest file
    • Add the following line:
      Code:
      Class-Path: ./lib/pircbotx-1.8.jar
    • Export your plugin again and check "Use existing manifest from workspace" this time
    • Create a "lib" in plugin directory(Edit: of your server)
    • Place pircbotx-1.8.jar in lib directory
    You are done.
     
  12. Offline

    Zumpz

    Okay, I can't find GENERATE MANIFEST FILE.
    [​IMG]

    [​IMG]
     
  13. Offline

    AmShaegar

    Click the next button at the bottom until you are on the last page.
     
  14. Offline

    Zumpz

    Where can I place MANIFEST file? In project? In src? Where :-p
     
  15. Offline

    AmShaegar

    Anywhere. I just left in the root directory of the project. It is included automatically at the right place on export.
     
  16. Offline

    Zumpz

    Okay, I did what you say, and the same error.
    And yes, I have made a new folder called "lib" in my /plugins/MursteinORG.
    I added pircbotx-1.8.jar in /plugins/MursteinORG/lib/
    Here is my project and MANIFEST:
    [​IMG]
     
  17. Offline

    AmShaegar

    do not create a lib directory in your eclipse project! You need to create the directory in the plugin directory of you server!

    Code:
    server/craftbucket.jar
    server/plugins/yourplugin.jar
    server/plugins/lib/pircbotx-1.8.jar
     
  18. Offline

    Zumpz

    Hah! Fixed! Thanks man! :)
     
  19. Offline

    AmShaegar

    No problem. I found that quite interesting and I felt like possibly running into this error as well in the future.
     
Thread Status:
Not open for further replies.

Share This Page