+ // FIND THE VERSION NUMBER AND BUILD DATE FROM jalview.jar\r
+ // MUST FOLLOW READING OF LOCAL PROPERTIES FILE AS THE\r
+ // VERSION MAY HAVE CHANGED SINCE LAST USING JALVIEW\r
+ try\r
+ {\r
+ String buildDetails = "jar:"\r
+ .concat(\r
+ Cache.class.getProtectionDomain().getCodeSource().getLocation().toString()\r
+ .concat("!/.build_properties")\r
+ );\r
+\r
+ java.net.URL localJarFileURL = new java.net.URL(buildDetails);\r
+\r
+ InputStream in = localJarFileURL.openStream();\r
+ applicationProperties.load(in);\r
+ in.close();\r
+ }\r
+ catch (Exception ex)\r
+ {\r
+ System.out.println("Error reading build details: "+ex);\r
+ applicationProperties.remove("VERSION");\r
+ }\r
+\r
+ String jnlpVersion = System.getProperty("jalview.version");\r
+ String codeVersion = getProperty("VERSION");\r
+\r
+\r
+ if(codeVersion==null)\r
+ {\r
+ // THIS SHOULD ONLY BE THE CASE WHEN TESTING!!\r
+ codeVersion = "Test";\r
+ jnlpVersion = "Test";\r
+ }\r
+\r
+\r
+ System.out.println("Jalview Version: "+codeVersion);\r
+\r
+\r
+ // jnlpVersion will be null if we're using InstallAnywhere\r
+ // Dont do this check if running in headless mode\r
+ if(jnlpVersion==null && (\r
+ System.getProperty("java.awt.headless")==null\r
+ || System.getProperty("java.awt.headless").equals("false")))\r
+ {\r
+\r
+ class VersionChecker\r
+ extends Thread\r
+ {\r
+ public void run()\r
+ {\r
+ String jnlpVersion = null;\r
+ try\r
+ {\r
+ java.net.URL url = new java.net.URL(\r
+ "http://www.jalview.org/webstart/jalview.jnlp");\r
+ BufferedReader in = new BufferedReader(new InputStreamReader(url.\r
+ openStream()));\r
+ String line = null;\r
+ while ( (line = in.readLine()) != null)\r
+ {\r
+ if (line.indexOf("jalview.version") == -1)\r
+ continue;\r
+\r
+ line = line.substring(line.indexOf("value=") + 7);\r
+ line = line.substring(0, line.lastIndexOf("\""));\r
+ jnlpVersion = line;\r
+ break;\r
+ }\r
+ }\r
+ catch (Exception ex)\r
+ {\r
+ System.out.println(ex);\r
+ jnlpVersion = getProperty("VERSION");\r
+ }\r
+\r
+ setProperty("LATEST_VERSION", jnlpVersion);\r
+ }\r
+ }\r
+\r
+ VersionChecker vc = new VersionChecker();\r
+ vc.start();\r
+ }\r
+ else\r
+ {\r
+ if(jnlpVersion!=null)\r
+ setProperty("LATEST_VERSION", jnlpVersion);\r
+ else\r
+ applicationProperties.remove("LATEST_VERSION");\r
+ }\r
+\r
+ setProperty("VERSION", codeVersion);\r
+\r
+ //LOAD USERDEFINED COLOURS\r
+ jalview.gui.UserDefinedColours.initUserColourSchemes( getProperty("USER_DEFINED_COLOURS"));\r
+ jalview.io.PIRFile.useModellerOutput = Cache.getDefault("PIR_MODELLER", false);\r