craftbukkit jar location

Discussion in 'Plugin Development' started by IDragonfire, Apr 1, 2013.

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

    IDragonfire

    Is there an easier way to find the craftbukkit.jar location?

    Atm I use:
    Code:
    getClass().getProtectionDomain().getCodeSource() .getLocation()
     
  2. I belive new File("."); would give you the working directory which should be the root of the server.

    Or you could go backwards from getDataFolder() by using getDataFolder() + "/../../" and root should be there.

    Not 100% sure about these though, experiment.

    However, why do you need it ?
     
  3. Offline

    IDragonfire

    I need the jar location ...
    and not all people named the jar "craftbukkit.jar" ...
    I want to support all previous and new versions of Bukkit and must read some class files from the jar ...
    More soon ;)
     
  4. Just check CraftBukkit's version instead of doing all that hacky unreliable stuff with jar name.

    Bukkit.getVersion() and Bukkit.getBukkitVersion(), see which one you need.
     
    ferrybig likes this.
  5. Offline

    IDragonfire

    I need the JarFile object,
    but thanks for the two methods ;)
     
  6. Offline

    IDragonfire

Thread Status:
Not open for further replies.

Share This Page