+ if (!LaunchUtils.checkJavaVersion())
+ {
+ System.err.println("WARNING - The Java version being used (Java "
+ + LaunchUtils.getJavaVersion()
+ + ") may lead to problems. This installation of Jalview should be used with Java "
+ + LaunchUtils.getJavaCompileVersion() + ".");
+ }
+
+ String jvmmempc = null;
+ String jvmmemmax = null;
+ boolean debug = false;
+ boolean wait = true;
+ boolean quiet = false;
+ boolean headless = false;
+ boolean gui = false;
+ // must set --debug before --launcher...
+ boolean launcherstop = false;
+ boolean launcherprint = false;
+ boolean launcherwait = false;
+ ArrayList<String> arguments = new ArrayList<>();
+ for (String arg : args)
+ {
+ if (arg.equals("--debug"))
+ {
+ debug = true;
+ }
+ if (arg.equals("--quiet"))
+ {
+ quiet = true;
+ }
+ if (arg.equals("--headless"))
+ {
+ headless = true;
+ }
+ if (arg.equals("--gui"))
+ {
+ gui = true;
+ }
+ if (debug && arg.equals("--launcherprint"))
+ {
+ launcherprint = true;
+ }
+ if (debug && arg.equals("--launcherstop"))
+ {
+ launcherstop = true;
+ }
+ if (debug && arg.equals("--launcherwait"))
+ {
+ launcherwait = true;
+ }
+ // this ends the launcher immediately
+ if (debug && arg.equals("--launchernowait"))
+ {
+ wait = false;
+ }
+ // Don't add the --launcher... args to Jalview launch
+ if (arg.startsWith("--launcher"))
+ {
+ continue;
+ }
+ // jvmmempc and jvmmemmax args used to set memory and are not passed on to
+ // startClass
+ if (arg.startsWith(
+ "-" + MemorySetting.MAX_HEAPSIZE_PERCENT_PROPERTY_NAME + "="))
+ {
+ jvmmempc = arg.substring(
+ MemorySetting.MAX_HEAPSIZE_PERCENT_PROPERTY_NAME.length()
+ + 2);
+ }
+ else if (arg.startsWith(
+ "-" + MemorySetting.MAX_HEAPSIZE_PROPERTY_NAME + "="))
+ {
+ jvmmemmax = arg.substring(
+ MemorySetting.MAX_HEAPSIZE_PROPERTY_NAME.length() + 2);
+ }
+ // --doubledash versions
+ else if (arg.startsWith("--"
+ + MemorySetting.MAX_HEAPSIZE_PERCENT_PROPERTY_NAME + "="))
+ {
+ jvmmempc = arg.substring(
+ MemorySetting.MAX_HEAPSIZE_PERCENT_PROPERTY_NAME.length()
+ + 3);
+ }
+ else if (arg.startsWith(
+ "--" + MemorySetting.MAX_HEAPSIZE_PROPERTY_NAME + "="))
+ {
+ jvmmemmax = arg.substring(
+ MemorySetting.MAX_HEAPSIZE_PROPERTY_NAME.length() + 3);
+ }
+ // retain arg
+ else
+ {
+ 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);