Error: Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified. Applies for all executables

前端 未结 2 466
轮回少年
轮回少年 2020-12-21 07:11

My goal is to run SVN commands from java for one of my requirements, for the same i have already installed TortoiseSVN command line tool. Added the appropriate path\"C:/Prog

2条回答
  •  清酒与你
    2020-12-21 08:03

    It's because you're not using ProcessBuilder correctly. The Javadocs are pretty clear cut.

    You can't pass the --version argument as part of the process name you're trying to invoke; that's not the filename of the process. Behind the scenes you're exec'ing a process directly - there's no shell involved.

    ProcessBuilder svnProcessBuilder = new ProcessBuilder("svn", "--version");
    

提交回复
热议问题