Apache Commons Exec

fmms 12年前
     Apache Commons Exec 是 Apache 上的一个 Java 项目,提供一些常用的方法用来执行外部进程,如下面代码所示:    <pre class="brush:java; toolbar: true; auto-links: false;">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);</pre>    <p><strong>项目主页:</strong><a href="http://www.open-open.com/lib/view/home/1326806394343" target="_blank">http://www.open-open.com/lib/view/home/1326806394343</a></p>