Using an external lib with bukkit.

Discussion in 'Plugin Development' started by Sabersamus, Aug 13, 2012.

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

    Sabersamus

    Hello, Lets say I wanted to use something like Joda, like this

    How would i be able to add the joda-time.jar to my class path, and then be able to use it with bukkit?

    Compiling it as a jar file doesn't include the required files from Joda, and i can't add joda-time.jar to
    the plugins folder, cause it doesn't have a plugin.yml
     
  2. Offline

    devilquak

    Download the source files from Github and plop them inside your src folder. Make sure all the class references are named correctly and have fun.
     
  3. Offline

    Sabersamus

    D: theres over 300 files.... and idk which ones i will need -_-
     
  4. Offline

    Jnorr44

    Or.... just download them as a .jar, and add them to your libraries (project>properties>Java Build Path>libraries)
     
  5. Offline

    Sabersamus


    Yes but that won't work, because when i export it the files that i used dont exist in bukkits library, so i would need to have access to the somehow
     
  6. Offline

    Icyene

    Put Joda.jar inside YOUR jar, and extract it to your plugins folder at runtime. Profit.
     
  7. Offline

    Sabersamus


    How?
     
  8. Offline

    Courier

    Put it inside a folder called "lib" inside your plugins folder. Add "./lib" to the jar's manifest classpath. I don't know exactly how to do this with Eclipse, but if you want help with ant you can pm me.
    Extracting it to your plugins folder would be problematic, because CB tries to load each .jar inside the plugins folder, but not recursively, so plugins/lib/Joda.jar should be fine.

    If you want to make distribution simpler, you could put Joda.jar inside your jar, and extract it to "./lib/Joda.jar" at runtime if it is not already there. (using file IO in Java... look it up)
     
Thread Status:
Not open for further replies.

Share This Page