JAL-3321 Corrected the badly configured getdown-launcher.jar for updating and updated...
authorBen Soares <bsoares@dundee.ac.uk>
Wed, 19 Jun 2019 00:29:05 +0000 (01:29 +0100)
committerBen Soares <bsoares@dundee.ac.uk>
Wed, 19 Jun 2019 00:29:05 +0000 (01:29 +0100)
build.gradle
getdown/lib/getdown-core-1.8.3-SNAPSHOT.jar
getdown/lib/getdown-launcher.jar
getdown/src/getdown/launcher/src/main/java/com/threerings/getdown/launcher/Getdown.java
getdown/src/getdown/launcher/src/main/java/com/threerings/getdown/launcher/GetdownApp.java
gradle.properties
j11lib/getdown-core.jar
j8lib/getdown-core.jar

index 71eb491..af9a26f 100644 (file)
@@ -807,7 +807,7 @@ task getdownWebsite() {
 
     // getdown-launcher.jar should not be in main application class path so the main application can move it when updated.  Listed as a resource so it gets updated.
     //getdownTextString += "class = " + file(getdownLauncher).getName() + "\n"
-    getdownTextString += "resource = " + file(getdownLauncher).getName() + "\n"
+    getdownTextString += "resource = " + getdown_launcher_new + "\n"
     getdownTextString += "class = " + mainClass + "\n"
 
     def getdown_txt = file(project.ext.getdownWebsiteDir + "/getdown.txt")
@@ -819,6 +819,13 @@ task getdownWebsite() {
     }
 
     copy {
+      from project.ext.getdownWebsiteDir
+      into project.ext.getdownWebsiteDir
+      include(file(getdownLauncher).getName())
+      rename(file(getdownLauncher).getName(), getdown_launcher_new)
+    }
+
+    copy {
       from getdownLauncher
       into project.ext.getdownFilesDir
     }
index bbeb351..8828380 100644 (file)
Binary files a/getdown/lib/getdown-core-1.8.3-SNAPSHOT.jar and b/getdown/lib/getdown-core-1.8.3-SNAPSHOT.jar differ
index 6323dc9..1efee70 100644 (file)
Binary files a/getdown/lib/getdown-launcher.jar and b/getdown/lib/getdown-launcher.jar differ
index 5750fce..d82ed15 100644 (file)
@@ -499,6 +499,19 @@ public abstract class Getdown extends Thread
             throw new IOException("m.java_download_failed");
         }
 
+        // on Windows, if the local JVM is in use, we will not be able to replace it with an
+        // updated JVM; we detect this by attempting to rename the java.dll to its same name, which
+        // will fail on Windows for in use files; hackery!
+        File javaLocalDir = new File(_app.getAppDir(), LaunchUtil.LOCAL_JAVA_DIR+File.separator);
+        File javaDll = new File(javaLocalDir, "bin" + File.separator + "java.dll");
+        if (javaDll.exists()) {
+            if (!javaDll.renameTo(javaDll)) {
+                log.info("Cannot update local Java VM as it is in use.");
+                return;
+            }
+            log.info("Can update local Java VM as it is not in use.");
+        }
+
         reportTrackingEvent("jvm_start", -1);
 
         updateStatus("m.downloading_java");
index 2d19089..eaf9f2e 100644 (file)
@@ -92,6 +92,7 @@ public class GetdownApp
     }
     if (abort) System.exit(-1);
 
+    log.info("Starting....");
     try
     {
       jalview.bin.StartupNotificationListener.setListener();
index 08bcbd7..9ec5511 100644 (file)
@@ -51,6 +51,7 @@ getdown_app_dir = dist
 #getdown_j11lib_dir = j11lib
 getdown_files_dir = getdown/files
 getdown_launcher = getdown/lib/getdown-launcher.jar
+getdown_launcher_new = getdown-launcher-new.jar
 getdown_core = getdown/lib/getdown-core-1.8.3-SNAPSHOT.jar
 getdown_base_txt = getdown/files/getdown.txt
 getdown_txt_title = Jalview
@@ -77,7 +78,7 @@ getdown_txt_ui.install_error = http://www.jalview.org/download/error
 getdown_txt_ui.mac_dock_icon = resources/images/jalview_logos.ico
 getdown_alt_java8_min_version  = 01080000
 getdown_alt_java11_min_version = 11000000
-getdown_alt_java11_txt_multi_java_location = [windows-amd64] /getdown/jre/windows-jre11.tgz,[linux-amd64] /getdown/jre/linux-jre11.tgz,[mac os x] /getdown/jre/macos-jre11.tgz
+getdown_alt_java11_txt_multi_java_location = [windows-amd64] /getdown/jre/windows-jre11.jar,[linux-amd64] /getdown/jre/linux-jre11.tgz,[mac os x] /getdown/jre/macos-jre11.tgz
 getdown_alt_java8_txt_multi_java_location = [windows-amd64] /getdown/jre/windows-jre1.8.tgz,[linux-amd64] /getdown/jre/linux-jre1.8.tgz,[mac os x] /getdown/jre/macos-jre1.8.tgz
 JRE_installs = /Users/bsoares/Java/installs
 Windows_JRE8 = OpenJDK8U-jdk_x64_windows_hotspot_8u202b08/jdk8u202-b08
index bbeb351..8828380 100644 (file)
Binary files a/j11lib/getdown-core.jar and b/j11lib/getdown-core.jar differ
index bbeb351..8828380 100644 (file)
Binary files a/j8lib/getdown-core.jar and b/j8lib/getdown-core.jar differ