4
我試圖執行一個程序(從ImageMagick轉換爲具體的),其父文件夾存在於路徑上。 Ergo,當我從命令行運行convert
時,它運行該命令。下面,然而,失敗:commons-exec:在系統PATH上執行程序?
String command = "convert"
CommandLine commandLine = CommandLine.parse(command);
commandLine.addArgument(...)
...
int exitValue = executor.execute(commandLine);
如果我指定的轉換可執行文件(C:\Program files\...
),那麼這個代碼工作的完整路徑。如果我不這樣做,我會得到一個異常拋出的值爲4
。
如何讓commons-exec識別系統路徑?