Merge commit '42b2e5ca519766e37ce6941ba4faecc9691cc403' into upstream
[debian/openrocket] / core / src / net / sf / openrocket / util / JarUtil.java
index b73438ed10bf8714dc80808de2206338ad4ba9c2..545cfa581d9e4f8e09c53b11d937a6f2de41c15a 100644 (file)
@@ -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();