X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=core%2Fsrc%2Fnet%2Fsf%2Fopenrocket%2Futil%2FJarUtil.java;h=545cfa581d9e4f8e09c53b11d937a6f2de41c15a;hb=6c394293bc3f3e275c1a77919214914876d27e8a;hp=b73438ed10bf8714dc80808de2206338ad4ba9c2;hpb=109b95aae3323e9c51b58d33d61dfe0a6c5bb7bc;p=debian%2Fopenrocket diff --git a/core/src/net/sf/openrocket/util/JarUtil.java b/core/src/net/sf/openrocket/util/JarUtil.java index b73438ed..545cfa58 100644 --- a/core/src/net/sf/openrocket/util/JarUtil.java +++ b/core/src/net/sf/openrocket/util/JarUtil.java @@ -18,8 +18,15 @@ public class JarUtil { */ public static File getCurrentJarFile() { // Find the jar file this class is contained in + URL jarUrl = null; - CodeSource codeSource = Database.class.getProtectionDomain().getCodeSource(); + CodeSource codeSource; + try { + codeSource = new URL("rsrc:.").openConnection().getClass().getProtectionDomain().getCodeSource(); + } catch (Throwable e) { + codeSource = Database.class.getProtectionDomain().getCodeSource(); + } + if (codeSource != null) jarUrl = codeSource.getLocation();