1 /********************
\r
2 * 2004 Jalview Reengineered
\r
10 package jalview.bin;
\r
14 import java.util.jar.*;
\r
17 public static String VERSION = "ß test";
\r
18 public static String BUILD_DATE = "1-1-2005";
\r
20 public static Properties applicationProperties;
\r
21 // Current properties include:
\r
23 // LAST_DIRECTORY , use this to cache record of where the user looked to find a file
\r
25 // USER_DEFINED_COLOUR - file describing last user set colours
\r
31 public static void loadProperties()
\r
33 // get last build time.
\r
37 String localFile = Cache.class.getProtectionDomain().getCodeSource().getLocation().toString();
\r
38 localFile = localFile.concat("!/");
\r
39 String tmpString = "jar:";
\r
40 String localJarFileString = tmpString.concat(localFile);
\r
41 java.net.URL localJarFileURL = new java.net.URL(localJarFileString);
\r
42 java.net.JarURLConnection localJarFile = (java.net.JarURLConnection)localJarFileURL.openConnection();
\r
44 date = localJarFile.getLastModified();
\r
48 // this is called for unpackaged class files.
\r
49 // not entirely accurate as it only tells you when Cache.class was last compiled
\r
50 java.net.URL url = Cache.class.getResource("/jalview/bin/Cache.class");
\r
51 java.io.File f = new java.io.File(url.getFile());
\r
52 date = f.lastModified();
\r
55 BUILD_DATE = new Date( date ).toString();
\r
58 }catch(Exception ex){ex.printStackTrace();}
\r
61 applicationProperties = new Properties();
\r
65 FileInputStream in = new FileInputStream(System.getProperty("user.home") +
\r
66 "/.jalview_properties");
\r
67 applicationProperties = new Properties();
\r
68 applicationProperties.load(in);
\r
71 catch (Exception ex)
\r
75 public static String getProperty(String key)
\r
77 return applicationProperties.getProperty(key);
\r
80 public static String setProperty(String key, String obj)
\r
84 FileOutputStream out = new FileOutputStream(System.getProperty(
\r
85 "user.home") + "/.jalview_properties");
\r
87 applicationProperties.setProperty(key, obj);
\r
89 applicationProperties.store(out, "---JalviewX Properties File---");
\r
92 catch (Exception ex)
\r