### Question:
CmdUtils { public static String run(CommandLine commandline) { try { ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); ByteArrayOutputStream errorStream = new ByteArrayOutputStream(); DefaultExecutor exec = new DefaultExecutor(); ExecuteWatchdog watchdog = new ExecuteWatchdog(60*1000); exec.setWatchdog(watchdog); exec.setExitValues(null); PumpStreamHandler streamHandler = new PumpStreamHandler(outputStream, errorStream); exec.setStreamHandler(streamHandler); exec.execute(commandline); String out = outputStream.toString("utf8"); String error = errorStream.toString("utf8"); return out + error; } catch (Exception e) { logger.error(e.getMessage(), e); return e.toString(); } }  static String run(CommandLine commandline); static String runCmd(String cmd); static String run(String[] cmd); static String callShell(String cmd);  }### Answer:
@Test public void test() { CommandLine cmd =new CommandLine("ps"); cmd.addArgument("-ef"); String rt=CmdUtils.run(cmd); System.err.println(rt); }