X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fbin%2FCache.java;h=94a1825c72d345315fddf2673cc6bececbd7f319;hb=5757f3c3ee60e52a2446ab111f35452cf4435ab2;hp=9e28f5d17ca82cf667d671e710d2bd68cd8e4ddc;hpb=fb616bbaa70ca0f8bbae7e076f3c403a737205a9;p=jalview.git diff --git a/src/jalview/bin/Cache.java b/src/jalview/bin/Cache.java index 9e28f5d..94a1825 100755 --- a/src/jalview/bin/Cache.java +++ b/src/jalview/bin/Cache.java @@ -38,6 +38,7 @@ import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.InputStream; import java.io.InputStreamReader; +import java.net.URL; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Collections; @@ -396,13 +397,13 @@ public class Cache } // LOAD THE AUTHORS FROM THE authors.props file - String authorDetails = resolveResourceURLFor("authors.props"); + String authorDetails = resolveResourceURLFor("/authors.props"); try { if (authorDetails != null) { - java.net.URL localJarFileURL = new java.net.URL(authorDetails); + URL localJarFileURL = new URL(authorDetails); InputStream in = localJarFileURL.openStream(); applicationProperties.load(in); in.close(); @@ -542,7 +543,8 @@ public class Cache url = Cache.class.getResource(resourcePath).toString(); } catch (Exception ex) { - + System.err.println("Failed to resolve resource " + resourcePath + ": " + + ex.getMessage()); } } else @@ -556,17 +558,16 @@ public class Cache public static void loadBuildProperties(boolean reportVersion) { String codeInstallation = getProperty("INSTALLATION"); - boolean printV = codeInstallation == null; + boolean printVersion = codeInstallation == null; - // FIND THE VERSION NUMBER AND BUILD DATE FROM jalview.jar + /* + * read build properties - from the Jalview jar for a Java distribution, + * or from codebase file in test or JalviewJS context + */ try { - String buildDetails = "jar:".concat(Cache.class.getProtectionDomain() - .getCodeSource().getLocation().toString() - .concat("!/.build_properties")); - - java.net.URL localJarFileURL = new java.net.URL(buildDetails); - + String buildDetails = resolveResourceURLFor("/.build_properties"); + URL localJarFileURL = new URL(buildDetails); InputStream in = localJarFileURL.openStream(); applicationProperties.load(in); in.close(); @@ -590,7 +591,7 @@ public class Cache } setProperty("VERSION", codeVersion); new BuildDetails(codeVersion, null, codeInstallation); - if (printV && reportVersion) + if (printVersion && reportVersion) { System.out .println("Jalview Version: " + codeVersion + codeInstallation);