Apache Commons Exec
Apache Commons Exec 是 Apache 上的一個 Java 項目,提供一些常用的方法用來執(zhí)行外部進程,如下面代碼所示:
String line = "AcroRd32.exe /p /h " + file.getAbsolutePath(); CommandLine commandLine = CommandLine.parse(line); DefaultExecutor executor = new DefaultExecutor(); executor.setExitValue(1); ExecuteWatchdog watchdog = new ExecuteWatchdog(60000); executor.setWatchdog(watchdog); int exitValue = executor.execute(commandLine);
評論
圖片
表情
