我发现了类似的问题,但没有一个解决方案解决了我的问题。 我突然开始收到这个错误。
java.io.IOException:无法运行程序" svn":CreateProcess error = 2, 该系统找不到指定的文件。
C:\ Program Files \ Java \ jdk1.8.0_152
命令是:
svn list --xml "+unfuddlefileurl+" --no-auth-cache --username " + unfuddleUserName + " --password " + unfuddlePassword
这是我的代码:
public static int runCommand(String command, String directory, String[] envp, File outputFile) throws IOException, InterruptedException
{
logger.logDebug(CLASSNAME, "COMMAND is " + command + " directory = " + directory);
Runtime rt = Runtime.getRuntime();
File workingDirectory = null;
if (directory != null)
workingDirectory = new File(directory);
Process proc = rt.exec(command, envp, workingDirectory);
// any error message?
StreamConsumer errorGobbler = new
StreamConsumer(proc.getErrorStream(), "ERROR", outputFile);
// any output?
StreamConsumer outputGobbler = new
StreamConsumer(proc.getInputStream(), "OUTPUT", outputFile);
// kick them off
errorGobbler.start();
outputGobbler.start();
// Note: This close() was added to make powershell commands work.
proc.getOutputStream().close();
// any error???
return proc.waitFor();
}
为什么我会收到此错误,如何解决?