List of usage examples for org.apache.commons.exec.launcher CommandLauncher exec
Process exec(final CommandLine cmd, final Map<String, String> env) throws IOException;
From source file:org.opennms.web.rest.v1.MeasurementsRestServiceITCase.java
protected static void assumeRrdtoolExists(final String libraryName) { final String libraryPath = System.getProperty("java.library.path", ""); if (!libraryPath.contains(":/usr/local/lib")) { System.setProperty("java.library.path", libraryPath + ":/usr/local/lib"); }/*from w ww . ja v a 2 s . co m*/ boolean rrdtoolExists = false; try { final CommandLauncher cl = CommandLauncherFactory.createVMLauncher(); final Process p = cl.exec(new CommandLine(findRrdtool()), EnvironmentUtils.getProcEnvironment()); final int returnCode = p.waitFor(); LOG.debug("Loading library from java.library.path={}", System.getProperty("java.library.path")); System.loadLibrary(libraryName); rrdtoolExists = returnCode == 0; } catch (final Exception e) { LOG.warn("Failed to run 'rrdtool' or libjrrd(2)? is missing.", e); } Assume.assumeTrue(rrdtoolExists); }