X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fjalview%2Fbin%2FLauncher.java;h=a87d32211d9bd1b727fa12cfd90ed4bc61644c4e;hb=353cb52722490edcba2c13b18836b6d37c5455de;hp=2155f8d17ac268353f129aa2f9449dc788833a84;hpb=7f0a4109670acd7b68b4f1d38c99da4f1dde608e;p=jalview.git diff --git a/src/jalview/bin/Launcher.java b/src/jalview/bin/Launcher.java index 2155f8d..a87d322 100644 --- a/src/jalview/bin/Launcher.java +++ b/src/jalview/bin/Launcher.java @@ -50,8 +50,28 @@ public class Launcher { private final static String startClass = "jalview.bin.Jalview"; - private final static String dockIconPath = ChannelProperties - .getProperty("logo.512"); + private static boolean checkJVMSymlink(String testBin) + { + File testBinFile = new File(testBin); + if (!testBinFile.exists()) + { + return false; + } + File targetFile = null; + try + { + targetFile = testBinFile.getCanonicalFile(); + } catch (IOException e) + { + return false; + } + if (targetFile != null && ("java".equals(targetFile.getName()) + || "java.exe".equals(targetFile.getName()))) + { + return true; + } + return false; + } /** * main method for jalview.bin.Launcher. This restarts the same JRE's JVM with @@ -70,9 +90,22 @@ public class Launcher + ") may lead to problems. This installation of Jalview should be used with Java " + LaunchUtils.getJavaCompileVersion() + "."); } - - final String javaBin = System.getProperty("java.home") + File.separator - + "bin" + File.separator + "java"; + final String appName = ChannelProperties.getProperty("app_name"); + final String javaBinDir = System.getProperty("java.home") + + File.separator + "bin" + File.separator; + String javaBin = null; + if (javaBin == null && checkJVMSymlink(javaBinDir + appName)) + { + javaBin = javaBinDir + appName; + } + if (javaBin == null && checkJVMSymlink(javaBinDir + "Jalview")) + { + javaBin = javaBinDir + "Jalview"; + } + if (javaBin == null) + { + javaBin = "java"; + } List command = new ArrayList<>(); command.add(javaBin); @@ -121,10 +154,8 @@ public class Launcher { launcherwait = true; } - // these quite immediately - if (arg.equals("--version") || arg.equals("--help") - || arg.startsWith("--help-") - || (debug && arg.equals("--launchernowait"))) + // this ends the launcher immediately + if (debug && arg.equals("--launchernowait")) { wait = false; } @@ -228,20 +259,21 @@ public class Launcher { if (!dockIcon) { + String dockIconPath = System.getProperty("getdownappdir", ".") + + File.separator + "resource/jalview_logo.png"; command.add("-Xdock:icon=" + dockIconPath); } if (!dockName) { // -Xdock:name=... doesn't actually work :( // Leaving it in in case it gets fixed - command.add( - "-Xdock:name=" + ChannelProperties.getProperty("app_name")); + command.add("-Xdock:name=" + appName); // this launches WITHOUT an icon in the macOS dock. Could be useful for // getdown? // command.add("-Dapple.awt.UIElement=false"); // This also does not work for the dock command.add("-Dcom.apple.mrj.application.apple.menu.about.name=" - + ChannelProperties.getProperty("app_name")); + + appName); } }