[HOW TO] Libs-directory for Bukkit

Discussion in 'Resources' started by LennardF1989, Jul 7, 2011.

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

    LennardF1989

    Just wanted to share this little trick. Contrary to wide believe, this is not something the Bukkit-team can change (easily). What you have to do, though, is get server-owners to start Bukkit differently, as it would make the use of external libraries a lot easier!

    Here's the trick:
    1. Create a "libs"-directory alongside of the "plugins"-directory.
    2. Modify your startup script from:
      to
    3. ...
    4. Profit?!
    Just drop any libraries your plugins require in there and you're ready to go. If all plugins that want to use libraries will enforce this way of starting up the server, it would allow developers to use/develop external libraries for plugins without having to include them in the plugin JAR.

    A trick the Bukkit developers can apply to enforce this, is removing the Main-Class attribute from the MANIFEST.MF-file.

    WARNING: You have to use this way to launch Bukkit. You can no longer use the "-jar" method, if you do, "-classpath" is ignored and a lot of ClassNotFoundExceptions will be thrown at you.
     
    jsgage likes this.
  2. What does this do? :O
     
  3. Offline

    tha d0ctor

    other than confusing both of us, I'm not sure what it does...
     
  4. It changes how the Java VM looks for classes.
    That little command line tells it to look in the craftbukkit jar, and the libs directory.

    It's a way to stop plugin devs having to manually call the classpath loader to get external librarys (for sqlite and such)
     
  5. Ahhh, thanks :)
     
  6. Offline

    alta189

    Good luck with that
     
  7. Offline

    jboer

    The above start-up script didn't work for me, because the "-classpath" argument takes ":" as a seperator, not ";".

    This is the fixed script:
    Code:
    java -Xmx<Memory>M -Xms<Memory>M -classpath "craftbukkit-0.0.1-SNAPSHOT.jar:libs/*" org.bukkit.craftbukkit.Main
     
  8. Offline

    MrMag518

    This is pretty good :)
    thanks.
     
Thread Status:
Not open for further replies.

Share This Page