【发布时间】:2011-02-11 04:33:30
【问题描述】:
我正在尝试执行其父文件夹存在于路径上的程序(具体而言,从 ImageMagick 转换)。因此,当我从命令行运行convert 时,它会运行命令。但是,以下失败:
String command = "convert"
CommandLine commandLine = CommandLine.parse(command);
commandLine.addArgument(...)
...
int exitValue = executor.execute(commandLine);
如果我指定转换可执行文件的完整路径 (C:\Program files\...),则此代码有效。如果我不这样做,我会抛出一个异常,退出值为 4。
如何让 commons-exec 识别系统路径?
【问题讨论】:
标签: java path environment-variables system-calls apache-commons-exec