Receiving the jar file of craftbukkit

Discussion in 'Plugin Development' started by Jobi, May 16, 2014.

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

    Jobi

    Is there any way to receive a File object (or the path) of the craftbukkit.jar (or however it's called)? And no, just going into the server directory and taking craftbukkit.jar is not what I want as the solution should be dynamic..
     
  2. Offline

    caseif

    Code:java
    1. File rootDir = Bukkit.getWorldContainer();

    That'll get you the root directory of the server. Not sure if there's a way to get the actual server JAR without using class manipulation. I'll look into it for you.

    Edit: See this SO post.
     
  3. Offline

    RawCode

    its possible to get jar name via "codesource" native, but there is no reason to do so, jar will be locked and no action can be performed on it.
     
  4. Offline

    Jobi

  5. Offline

    RawCode

    if you know what stackoverflow it use keywords "detect if class running from jar"
     
  6. Offline

    Jobi

    Won't his return the plugin jar, as I'm calling it from my plugin?
     
  7. Offline

    RawCode

    you shoud invoke codesource on Bukkit.getServer().getClass()

    in case of invoking on something like this.getCkass() you will get your plugin's jar.
     
Thread Status:
Not open for further replies.

Share This Page