</p>
<p>
- <em>Important!</em> If you use <code>--output</code> or any other argument that outputs a file, then it will be assumed you want to run Jalview in headless mode (as if you had specified <code>--headless</code>). To use Jalview with <code>--output</code> and not assume headless mode, use the <code>--gui</code> or <code>--noheadless</code> argument (the order doesn't matter).
+ <em>Important!</em> If you use <code>--output</code> or any other argument that outputs a file, then it will be assumed you want to run Jalview in headless mode (as if you had specified <code>--headless</code>). To use Jalview with <code>--output</code> and not assume headless mode, use the <code>--gui</code> argument (the order doesn't matter).
</p>
+ <p>
+ If you would like to output an alignment file directly to standard output (often referred to as STDOUT), then use the filename <code>-</code> (a single hyphen). In this case any messages that would normally appear on STDOUT will be diverted to STDERR to avoid invalidating the output file.
+ </p>
+ <p>
+ For example, to open a Stockholm file and pipe it to another command as a Block file, do
+ <pre>
+ jalview --open alignment1.stk --output - --format blc | another_command
+ </pre>
+ or equivalently
+ <pre>
+ jalview alignment1.stk --output=[format=blc]- | another_command
+ </pre>
+ </p>
+
<h3><a name="format"></a><code>--format</code></h3>
<p>
}
} catch (NumberFormatException e)
{
- System.err.println(setHiDPIScalePropertyName + " property give ("
- + setHiDPIScaleProperty + ") but not parseable as integer");
- jalview.bin.Console.errPrintln(setHiDPIScalePropertyName + " property give ("
- + setHiDPIScaleProperty + ") but not parseable as integer");
++ jalview.bin.Console.errPrintln(setHiDPIScalePropertyName
++ + " property give (" + setHiDPIScaleProperty
++ + ") but not parseable as integer");
}
}
if (setHiDPI && setHiDPIScale > 0)
try
{
int existingPropertyVal = Integer.parseInt(existingProperty);
- System.out.println("Existing " + scalePropertyName + " is "
- + existingPropertyVal);
- jalview.bin.Console.outPrintln("Existing " + scalePropertyName + " is "
- + existingPropertyVal);
++ jalview.bin.Console.outPrintln("Existing " + scalePropertyName
++ + " is " + existingPropertyVal);
if (existingPropertyVal > 1)
{
setHiDPIScale(existingPropertyVal);
}
} catch (NumberFormatException e)
{
- System.out.println("Could not convert property " + scalePropertyName
- + " vale '" + existingProperty + "' to number");
- jalview.bin.Console.outPrintln("Could not convert property " + scalePropertyName
- + " vale '" + existingProperty + "' to number");
++ jalview.bin.Console.outPrintln(
++ "Could not convert property " + scalePropertyName
++ + " vale '" + existingProperty + "' to number");
}
}
dpi = screenInfo.getScreenResolution();
} catch (HeadlessException e)
{
- jalview.bin.Console.errPrintln("Cannot get screen resolution: " + e.getMessage());
+ if (isLinux)
+ {
- System.err
- .println("Cannot get screen resolution: " + e.getMessage());
++ jalview.bin.Console.errPrintln(
++ "Cannot get screen resolution: " + e.getMessage());
+ }
}
// try and get screen size height and width
mindimension = Math.min(height, width);
} catch (HeadlessException e)
{
- jalview.bin.Console.errPrintln(
- "Cannot get screen size height and width:" + e.getMessage());
+ if (isLinux)
+ {
- System.err.println("Cannot get screen size height and width:"
- + e.getMessage());
++ jalview.bin.Console
++ .errPrintln("Cannot get screen size height and width:"
++ + e.getMessage());
+ }
}
// attempt at a formula for scaling based on screen dpi and mindimension.
{
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() + ".");
- jalview.bin.Console.errPrintln("WARNING - The Java version being used (Java "
- + LaunchUtils.getJavaVersion()
- + ") 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";
++ jalview.bin.Console
++ .errPrintln("WARNING - The Java version being used (Java "
++ + LaunchUtils.getJavaVersion()
++ + ") may lead to problems. This installation of Jalview should be used with Java "
++ + LaunchUtils.getJavaCompileVersion() + ".");
}
- if (javaBin == null)
- {
- javaBin = "java";
- }
-
- List<String> 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;
boolean debug = false;
boolean wait = true;
boolean quiet = false;
+ boolean headless = false;
+ boolean gui = false;
+ boolean stdout = false;
// must set --debug before --launcher...
boolean launcherstop = false;
boolean launcherprint = false;
{
quiet = true;
}
+ if (arg.equals("--headless"))
+ {
+ headless = true;
+ }
+ if (arg.equals("--gui"))
+ {
+ gui = true;
+ }
+ if (arg.equals("--output=-")
+ || (arg.equals("-") && "--output".equals(previousArg)))
+ {
+ stdout = true;
+ }
if (debug && arg.equals("--launcherprint"))
{
launcherprint = true;
{
if (e.getMessage().toLowerCase(Locale.ROOT).contains("memory"))
{
- System.err.println("Caught a memory exception: " + e.getMessage());
- jalview.bin.Console.errPrintln("Caught a memory exception: " + e.getMessage());
++ jalview.bin.Console
++ .errPrintln("Caught a memory exception: " + e.getMessage());
// Probably the "Cannot allocate memory" error, try without the memory
// setting
ArrayList<String> commandNoMem = new ArrayList<>();