/** * 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; } }
logger.info(output); output = launcher.getErrorOutput(); if (output.length() > 0) { logger.warn(output);
logger.info(output); output = launcher.getErrorOutput(); if (output.length() > 0) { logger.warn(output);