made error for browser configuration on unix a bit easier to see.
[jalview.git] / src / jalview / bin / Cache.java
index e0edae8..226a925 100755 (executable)
@@ -11,8 +11,12 @@ package jalview.bin;
 import java.util.*;\r
 import java.io.*;\r
 \r
+import java.util.jar.*;\r
 public class Cache\r
 {\r
+  public static String  VERSION = "Release 2.0";\r
+  public static String  BUILD_DATE = "";\r
+\r
   public static Properties applicationProperties;\r
   // Current properties include:\r
   //\r
@@ -22,10 +26,35 @@ public class Cache
   // FONT_NAME\r
   // FONT_STYLE\r
   // FONT_SIZE\r
-\r
-\r
+  // logs.Axis.Level - one of the stringified Levels for log4j controlling the logging level for axis (used for web services)\r
+  // jalview.browser - used in the jalview.utils.browserLauncher class if it doesn't know what else to do.\r
   public static void loadProperties()\r
   {\r
+    // get last build time.\r
+    long date = 0;\r
+    try{\r
+          String localFile = Cache.class.getProtectionDomain().getCodeSource().getLocation().toString();\r
+          localFile = localFile.concat("!/");\r
+          String tmpString = "jar:";\r
+          String localJarFileString = tmpString.concat(localFile);\r
+          java.net.URL localJarFileURL = new java.net.URL(localJarFileString);\r
+          java.net.JarURLConnection localJarFile = (java.net.JarURLConnection)localJarFileURL.openConnection();\r
+          date = localJarFile.getLastModified();\r
+    }catch(Exception ex){ex.printStackTrace();}\r
+    if(date==0)\r
+    {\r
+      // this is called for unpackaged class files, ie not in a Jar file\r
+      // InstallAnywhere version will find build date this way\r
+      // not entirely accurate as it only tells you when Cache.class was last compiled\r
+\r
+\r
+     java.io.File f = new java.io.File(System.getProperty("user.dir") + "/jalview/bin/Cache.class" );\r
+     date = f.lastModified();\r
+    }\r
+\r
+    if(date!=0)\r
+      BUILD_DATE = new Date( date ).toString();\r
+\r
     applicationProperties = new Properties();\r
 \r
     try\r