*
*/
{
- System.out.println("not in js");
+ Console.outputMessage("not in js");
}
// BH - for event debugging in JavaScript (Java mode only)
}.start();
}
- if (!quiet() || bootstrapArgs.contains(Arg.VERSION))
+ if (!quiet() || !bootstrapArgs.outputToStdout()
+ || bootstrapArgs.contains(Arg.VERSION))
{
- System.out.println(
+ Console.outputMessage(
"Java version: " + System.getProperty("java.version"));
- System.out.println("Java home: " + System.getProperty("java.home"));
- System.out.println("Java arch: " + System.getProperty("os.arch") + " "
- + System.getProperty("os.name") + " "
+ Console.outputMessage(
+ "Java home: " + System.getProperty("java.home"));
+ Console.outputMessage("Java arch: " + System.getProperty("os.arch")
+ + " " + System.getProperty("os.name") + " "
+ System.getProperty("os.version"));
String val = System.getProperty("sys.install4jVersion");
if (val != null)
{
- System.out.println("Install4j version: " + val);
+ Console.outputMessage("Install4j version: " + val);
}
val = System.getProperty("installer_template_version");
if (val != null)
{
- System.out.println("Install4j template version: " + val);
+ Console.outputMessage("Install4j template version: " + val);
}
val = System.getProperty("launcher_version");
if (val != null)
{
- System.out.println("Launcher version: " + val);
+ Console.outputMessage("Launcher version: " + val);
}
}
// register SIGTERM listener
Runtime.getRuntime().addShutdownHook(new Thread()
{
+ @Override
public void run()
{
Console.debug("Running shutdown hook");
Cache.loadProperties(usrPropsFile);
if (usrPropsFile != null)
{
- System.out.println(
+ Console.outputMessage(
"CMD [-props " + usrPropsFile + "] executed successfully!");
testoutput(bootstrapArgs, Arg.PROPS,
"test/jalview/bin/testProps.jvprops", usrPropsFile);
{
List<Map.Entry<Type, String>> helpArgs = bootstrapArgs
.getList(Arg.HELP);
- System.out.println(Arg.usage(helpArgs.stream().map(e -> e.getKey())
- .collect(Collectors.toList())));
+ Console.outputMessage(Arg.usage(helpArgs.stream()
+ .map(e -> e.getKey()).collect(Collectors.toList())));
Jalview.exit(null, 0);
}
if (aparser.contains("help") || aparser.contains("h"))
* Now using new usage statement.
showUsage();
*/
- System.out.println(Arg.usage());
+ Console.outputMessage(Arg.usage());
Jalview.exit(null, 0);
}
try
{
Jws2Discoverer.getDiscoverer().setPreferredUrl(jabawsUrl);
- System.out.println(
+ Console.outputMessage(
"CMD [-jabaws " + jabawsUrl + "] executed successfully!");
testoutput(bootstrapArgs, Arg.JABAWS,
"http://www.compbio.dundee.ac.uk/jabaws", jabawsUrl);
}
else
{
- System.out.println("Executing setprop argument: " + setprop);
+ System.err.println("Executing setprop argument: " + setprop);
if (Platform.isJS())
{
Cache.setProperty(setprop.substring(0, p),
}
else
{
- System.out.println("CMD [-nousagestats] executed successfully!");
+ Console.outputMessage(
+ "CMD [-nousagestats] executed successfully!");
testoutput(argparser, Arg.NOUSAGESTATS);
}
// questionnaire
Console.debug("Starting questionnaire url at " + url);
desktop.checkForQuestionnaire(url);
- System.out.println("CMD questionnaire[-" + url
+ Console.outputMessage("CMD questionnaire[-" + url
+ "] executed successfully!");
}
else
}
else
{
- System.out
- .println("CMD [-noquestionnaire] executed successfully!");
+ Console.outputMessage(
+ "CMD [-noquestionnaire] executed successfully!");
testoutput(argparser, Arg.QUESTIONNAIRE);
}
.getString("status.processing_commandline_args"),
progress = System.currentTimeMillis());
}
- System.out.println("CMD [-open " + file + "] executed successfully!");
+ Console.outputMessage(
+ "CMD [-open " + file + "] executed successfully!");
if (!Platform.isJS())
/**
format);
if (af == null)
{
- System.out.println("error");
+ Console.outputMessage("error");
}
else
{
if (cs != null)
{
- System.out.println(
+ Console.outputMessage(
"CMD [-colour " + data + "] executed successfully!");
}
af.changeColour(cs);
{
af.parseFeaturesFile(data,
AppletFormatAdapter.checkProtocol(data));
- // System.out.println("Added " + data);
- System.out.println(
+ // Console.outputMessage("Added " + data);
+ Console.outputMessage(
"CMD groups[-" + data + "] executed successfully!");
}
data = aparser.getValue("features", true);
{
af.parseFeaturesFile(data,
AppletFormatAdapter.checkProtocol(data));
- // System.out.println("Added " + data);
- System.out.println(
+ // Console.outputMessage("Added " + data);
+ Console.outputMessage(
"CMD [-features " + data + "] executed successfully!");
}
if (data != null)
{
af.loadJalviewDataFile(data, null, null, null);
- // System.out.println("Added " + data);
- System.out.println(
+ // Console.outputMessage("Added " + data);
+ Console.outputMessage(
"CMD [-annotations " + data + "] executed successfully!");
}
// set or clear the sortbytree flag.
af.getViewport().setSortByTree(true);
if (af.getViewport().getSortByTree())
{
- System.out.println("CMD [-sortbytree] executed successfully!");
+ Console.outputMessage(
+ "CMD [-sortbytree] executed successfully!");
}
}
if (aparser.contains("no-annotation"))
af.getViewport().setShowAnnotation(false);
if (!af.getViewport().isShowAnnotation())
{
- System.out.println("CMD no-annotation executed successfully!");
+ Console.outputMessage(
+ "CMD no-annotation executed successfully!");
}
}
if (aparser.contains("nosortbytree"))
af.getViewport().setSortByTree(false);
if (!af.getViewport().getSortByTree())
{
- System.out
- .println("CMD [-nosortbytree] executed successfully!");
+ Console.outputMessage(
+ "CMD [-nosortbytree] executed successfully!");
}
}
data = aparser.getValue("tree", true);
{
try
{
- System.out.println(
+ Console.outputMessage(
"CMD [-tree " + data + "] executed successfully!");
NewickFile nf = new NewickFile(data,
AppletFormatAdapter.checkProtocol(data));
{
// Execute the groovy script after we've done all the rendering stuff
// and before any images or figures are generated.
- System.out.println("Executing script " + groovyscript);
+ Console.outputMessage("Executing script " + groovyscript);
executeGroovyScript(groovyscript, af);
- System.out.println("CMD groovy[" + groovyscript
+ Console.outputMessage("CMD groovy[" + groovyscript
+ "] executed successfully!");
groovyscript = null;
}
if (outputFormat.equalsIgnoreCase("png"))
{
- System.out.println("Creating PNG image: " + file);
+ Console.outputMessage("Creating PNG image: " + file);
af.createPNG(new File(file));
imageName = (new File(file)).getName();
continue;
}
else if (outputFormat.equalsIgnoreCase("svg"))
{
- System.out.println("Creating SVG image: " + file);
+ Console.outputMessage("Creating SVG image: " + file);
File imageFile = new File(file);
imageName = imageFile.getName();
af.createSVG(imageFile);
imageName = imageFile.getName();
HtmlSvgOutput htmlSVG = new HtmlSvgOutput(af.alignPanel);
- System.out.println("Creating HTML image: " + file);
+ Console.outputMessage("Creating HTML image: " + file);
htmlSVG.exportHTML(file);
continue;
}
e.printStackTrace();
}
BioJsHTMLOutput bjs = new BioJsHTMLOutput(af.alignPanel);
- System.out.println(
+ Console.outputMessage(
"Creating BioJS MSA Viwer HTML file: " + file);
bjs.exportHTML(file);
continue;
}
else if (outputFormat.equalsIgnoreCase("imgMap"))
{
- System.out.println("Creating image map: " + file);
+ Console.outputMessage("Creating image map: " + file);
af.createImageMap(new File(file), imageName);
continue;
}
else if (outputFormat.equalsIgnoreCase("eps"))
{
File outputFile = new File(file);
- System.out.println(
+ Console.outputMessage(
"Creating EPS file: " + outputFile.getAbsolutePath());
af.createEPS(outputFile);
continue;
outFormat = FileFormats.getInstance().forName(outputFormat);
} catch (Exception formatP)
{
- System.out.println("Couldn't parse " + outFormat
+ Console.outputMessage("Couldn't parse " + outFormat
+ " as a valid Jalview format string.");
}
if (outFormat != null)
{
if (!outFormat.isWritable())
{
- System.out.println(
+ Console.outputMessage(
"This version of Jalview does not support alignment export as "
+ outputFormat);
}
af.saveAlignment(file, outFormat);
if (af.isSaveAlignmentSuccessful())
{
- System.out.println("Written alignment in "
+ Console.outputMessage("Written alignment in "
+ outFormat.getName() + " format to " + file);
}
else
{
- System.out.println("Error writing file " + file + " in "
- + outFormat.getName() + " format!!");
+ Console.outputMessage("Error writing file " + file
+ + " in " + outFormat.getName() + " format!!");
}
}
}
} catch (ImageOutputException ioexc)
{
- System.out.println(
+ Console.outputMessage(
"Unexpected error whilst exporting image to " + file);
ioexc.printStackTrace();
}
while (aparser.getSize() > 0)
{
- System.out.println("Unknown arg: " + aparser.nextValue());
+ Console.outputMessage("Unknown arg: " + aparser.nextValue());
}
}
}
{
if (Cache.groovyJarsPresent())
{
- System.out.println("Executing script " + groovyscript);
+ Console.outputMessage("Executing script " + groovyscript);
executeGroovyScript(groovyscript, startUpAlframe);
}
else
{
if (exitcode == 0)
{
- System.out.println(message);
+ Console.outputMessage(message);
}
else
{
if (yes && ((s1 == null && s2 == null)
|| (s1 != null && s1.equals(s2))))
{
- System.out.println("[TESTOUTPUT] arg " + a.argString() + "='" + s1
+ Console.outputMessage("[TESTOUTPUT] arg " + a.argString() + "='" + s1
+ "' was set");
}
}
{
message = a.argString() + (yes ? " was set" : " was not set");
}
- System.out.println("[TESTOUTPUT] arg " + message);
+ Console.outputMessage("[TESTOUTPUT] arg " + message);
}
}
boolean debug = false;
boolean wait = true;
boolean quiet = false;
+ boolean stdout = false;
// must set --debug before --launcher...
boolean launcherstop = false;
boolean launcherprint = false;
boolean launcherwait = false;
ArrayList<String> arguments = new ArrayList<>();
+ String previousArg = null;
for (String arg : args)
{
if (arg.equals("--debug"))
{
quiet = true;
}
+ if (arg.equals("--output=-")
+ || (arg.equals("-") && "--output".equals(previousArg)))
+ {
+ stdout = true;
+ }
if (debug && arg.equals("--launcherprint"))
{
launcherprint = true;
{
wait = false;
}
+ previousArg = arg;
// Don't add the --launcher... args to Jalview launch
if (arg.startsWith("--launcher"))
{
String scalePropertyArg = HiDPISetting.getScalePropertyArg();
if (scalePropertyArg != null)
{
- sysout(debug, quiet, "Running " + startClass + " with scale setting "
+ syserr(debug, quiet, "Running " + startClass + " with scale setting "
+ scalePropertyArg);
command.add(scalePropertyArg);
}
if ((Boolean.parseBoolean(System.getProperty("launcherprint", "false"))
|| launcherprint))
{
- sysout(debug, quiet,
+ syserr(debug, quiet,
"LAUNCHER COMMAND: " + String.join(" ", builder.command()));
}
- sysout(debug, quiet,
+ syserr(debug, quiet,
"Running " + startClass + " with "
+ (memSetting == null ? "no memory setting"
: ("memory setting " + memSetting)));
if (Boolean.parseBoolean(System.getProperty("launcherstop", "false"))
|| (debug && launcherstop))
{
- sysout(debug, quiet,
+ syserr(debug, quiet,
"System property 'launcherstop' is set and not 'false'. Exiting.");
System.exit(0);
}
Process process = builder.start();
if (wait || launcherwait)
{
- sysout(debug, quiet, "Launching application process");
+ syserr(debug, quiet, "Launching application process");
process.waitFor();
}
else
{
int waitInt = 0;
- sysout(debug, quiet,
+ syserr(debug, quiet,
"Wait time for application process is " + waitInt + "ms");
process.waitFor(waitInt, TimeUnit.MILLISECONDS);
}
- sysout(debug, quiet, "Launcher process ending");
+ syserr(debug, quiet, "Launcher process ending");
} catch (IOException e)
{
if (e.getMessage().toLowerCase(Locale.ROOT).contains("memory"))
}
}
- private static void sysout(boolean debug, boolean quiet, String message)
+ private static void syserr(boolean debug, boolean quiet, String message)
{
if (debug && !quiet)
{
- System.out.println("LAUNCHERDEBUG - " + message);
+ System.err.println("LAUNCHERDEBUG - " + message);
}
}