我有一个exe文件:“TVRRun.exe”,位于目录:“C:\ Program Files(x86)\ TeleVantage \ Client \ Reporter”。
我正在尝试从java代码运行该exe文件:
public static void runTVRRun() throws IOException {
String path = System.getenv("programfiles(x86)") + "\\TeleVantage\\Client\\Reporter\\";
String[] command = {"TVRRun.exe", "-S", templatePath, "-S", tmpReportPath};
Runtime.getRuntime().exec(command, null, new File(path));
}
但是我收到以下错误:
Exception in thread "main" java.io.IOException:
Cannot run program "TVRRun.exe" (in directory "C:\Program Files (x86)\TeleVantage\Client\Reporter"):
CreateProcess error=2, The system cannot find the file specified
我已经尝试了exec函数的所有变体,以及ProcessBuilder,但是出现了同样的错误。