X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fbin%2FLauncher.java;h=20a466b422338e8d76ca775ede8e91f60cab2630;hb=ed379d3f998a6aea83ce8c9cdaab2ec8234adb6a;hp=c333e2ef09d144412de0e06777ea25753e8feb05;hpb=e5d038fc1bfc07d3879ef57f7726c60617988965;p=jalview.git diff --git a/src/jalview/bin/Launcher.java b/src/jalview/bin/Launcher.java index c333e2e..20a466b 100644 --- a/src/jalview/bin/Launcher.java +++ b/src/jalview/bin/Launcher.java @@ -52,29 +52,6 @@ public class Launcher private final static String headlessProperty = "java.awt.headless"; - 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 * the same arguments but with memory adjusted based on extracted -jvmmempc @@ -92,38 +69,6 @@ public class Launcher + ") may lead to problems. This installation of Jalview should be used with Java " + LaunchUtils.getJavaCompileVersion() + "."); } - final String appName = ChannelProperties.getProperty("app_name"); - final String javaBinDir = System.getProperty("java.home") - + File.separator + "bin" + File.separator; - String javaBin = null; - for (String name : new String[] { appName, "Jalview", "java", - "java.exe" }) - { - if (checkJVMSymlink(javaBinDir + name)) - { - javaBin = javaBinDir + name; - break; - } - } - if (javaBin == null) - { - javaBin = "java"; - } - - List command = new ArrayList<>(); - command.add(javaBin); - - String memSetting = null; - - boolean isAMac = System.getProperty("os.name").indexOf("Mac") > -1; - - for (String jvmArg : ManagementFactory.getRuntimeMXBean() - .getInputArguments()) - { - command.add(jvmArg); - } - command.add("-cp"); - command.add(ManagementFactory.getRuntimeMXBean().getClassPath()); String jvmmempc = null; String jvmmemmax = null; @@ -218,6 +163,24 @@ public class Launcher headless = false; } + final String appName = ChannelProperties.getProperty("app_name"); + + // if we're using jalview.bin.Launcher we always assume a console is in use + final String javaBin = LaunchUtils.findJavaBin(true); + + List command = new ArrayList<>(); + command.add(javaBin); + + String memSetting = null; + + for (String jvmArg : ManagementFactory.getRuntimeMXBean() + .getInputArguments()) + { + command.add(jvmArg); + } + command.add("-cp"); + command.add(ManagementFactory.getRuntimeMXBean().getClassPath()); + // use saved preferences if no cmdline args boolean useCustomisedSettings = LaunchUtils .getBooleanUserPreference(MemorySetting.CUSTOMISED_SETTINGS); @@ -278,7 +241,7 @@ public class Launcher } } - if (isAMac) + if (LaunchUtils.isMac) { if (!dockIcon) {