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;
}
// 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();
url = Cache.class.getResource(resourcePath).toString();
} catch (Exception ex)
{
-
+ System.err.println("Failed to resolve resource " + resourcePath + ": "
+ + ex.getMessage());
}
}
else
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();
}
setProperty("VERSION", codeVersion);
new BuildDetails(codeVersion, null, codeInstallation);
- if (printV && reportVersion)
+ if (printVersion && reportVersion)
{
System.out
.println("Jalview Version: " + codeVersion + codeInstallation);