X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=core%2Fsrc%2Fnet%2Fsf%2Fopenrocket%2Futil%2FJarUtil.java;fp=core%2Fsrc%2Fnet%2Fsf%2Fopenrocket%2Futil%2FJarUtil.java;h=545cfa581d9e4f8e09c53b11d937a6f2de41c15a;hb=9349577cdfdff682b2aabd6daa24fdc3a7449b58;hp=b73438ed10bf8714dc80808de2206338ad4ba9c2;hpb=30ba0a882f0c061176ba14dbf86d3d6fad096c02;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();