X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fjalview%2Fbin%2FLauncher.java;h=20a466b422338e8d76ca775ede8e91f60cab2630;hb=ed379d3f998a6aea83ce8c9cdaab2ec8234adb6a;hp=f199002b5bf3f8014322d35748fc642599cb2fda;hpb=5e462885d21193706d23e42cd5e21e88763788cb;p=jalview.git diff --git a/src/jalview/bin/Launcher.java b/src/jalview/bin/Launcher.java index f199002..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,37 +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; - 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); - - 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; @@ -130,6 +76,7 @@ public class Launcher boolean wait = true; boolean quiet = false; boolean headless = false; + boolean gui = false; // must set --debug before --launcher... boolean launcherstop = false; boolean launcherprint = false; @@ -149,6 +96,10 @@ public class Launcher { headless = true; } + if (arg.equals("--gui")) + { + gui = true; + } if (debug && arg.equals("--launcherprint")) { launcherprint = true; @@ -206,6 +157,29 @@ public class Launcher arguments.add(arg); } } + if (gui) + { + // --gui takes precedence over --headless + 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 @@ -267,7 +241,7 @@ public class Launcher } } - if (isAMac) + if (LaunchUtils.isMac) { if (!dockIcon) {