From: amwaterhouse Date: Fri, 1 Apr 2005 16:38:04 +0000 (+0000) Subject: Build date determination X-Git-Tag: Release_2_0~501 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=602170f45acfb7a45d92d7ced1f2f1206d6fc4dd;p=jalview.git Build date determination --- diff --git a/src/jalview/bin/Cache.java b/src/jalview/bin/Cache.java index 7eaae62..7dbdc94 100755 --- a/src/jalview/bin/Cache.java +++ b/src/jalview/bin/Cache.java @@ -31,31 +31,27 @@ public class Cache public static void loadProperties() { // get last build time. + long date = 0; try{ - long date = 0; - String localFile = Cache.class.getProtectionDomain().getCodeSource().getLocation().toString(); localFile = localFile.concat("!/"); String tmpString = "jar:"; String localJarFileString = tmpString.concat(localFile); java.net.URL localJarFileURL = new java.net.URL(localJarFileString); java.net.JarURLConnection localJarFile = (java.net.JarURLConnection)localJarFileURL.openConnection(); - date = localJarFile.getLastModified(); + }catch(Exception ex){ex.printStackTrace();} + if(date==0) + { + // this is called for unpackaged class files. + // not entirely accurate as it only tells you when Cache.class was last compiled + java.net.URL url = Cache.class.getResource("/jalview/bin/Cache.class"); + java.io.File f = new java.io.File(url.getFile()); + date = f.lastModified(); + } - if(date==0) - { - // this is called for unpackaged class files. - // not entirely accurate as it only tells you when Cache.class was last compiled - java.net.URL url = Cache.class.getResource("/jalview/bin/Cache.class"); - java.io.File f = new java.io.File(url.getFile()); - date = f.lastModified(); - } - - BUILD_DATE = new Date( date ).toString(); - + BUILD_DATE = new Date( date ).toString(); - }catch(Exception ex){ex.printStackTrace();} applicationProperties = new Properties();