String output = launcher.getStandardOutput();
/** * Opens applications by invoking 'kfmclient' that is part of KDE. */ @Override public int openWithDesktopEnvironment(String resource) throws UnsupportedOperationException, IOException { if (resource != null) { ProcessLauncher launcher = new ProcessLauncher(new String[] { "kfmclient", "exec", resource }, null); int exitValue = launcher.launch(); if (exitValue != 0) { logger.warn("Opening \"" + resource + "\" returned error code " + exitValue); } if (launcher.getStandardOutput().length() > 0) { logger.info(launcher.getStandardOutput()); } if (launcher.getErrorOutput().length() > 0) { logger.warn(launcher.getErrorOutput()); } return exitValue; } return -1; } }
/** * Open the resource by invoking the "open" command on the command line. */ @Override public int openResource(String resource) throws IOException { // bail out if nothing to open... if (resource != null) { // open works on file URI's too! :) ProcessLauncher launcher = new ProcessLauncher(new String[] { "open", resource }); int result = launcher.launch(); // show output from command if (launcher.getStandardOutput().length() > 0) { logger.info(launcher.getStandardOutput()); } if (launcher.getErrorOutput().length() > 0) { logger.warn(launcher.getErrorOutput()); } return result; } return -1; } }
String output = launcher.getStandardOutput(); if (output.length() > 0) { logger.info(output);
String output = launcher.getStandardOutput(); if (output.length() > 0) { logger.info(output);
ProcessLauncher launcher = new ProcessLauncher(new String[] { "file", "-b", "-i", uri.getPath() }, null); if (launcher.launch() == 0) { if (launcher.getStandardOutput().trim().length() > 0) { String output = launcher.getStandardOutput().trim(); if (output.indexOf("\n") < 0 && output.indexOf("/") > 0) { int semiColonIndex = output.indexOf(";");