0

这是JAVA编程语言问题

这是我试图执行的代码:

MyRuntime = Runtime.getRuntime();
File temp = new File("C:\\Command Line Apps\\cURL\\");
for(String filenames : temp.list()) System.out.println(filenames);
curl = MyRuntime.exec("curl.exe", null, temp);

输出是:

java ScreenshotMaker

build.txt
CHANGES
COPYING
curl.exe
curl.html
curl.pdf
libcurl.dll
libeay32.dll
libidn-11.dll
libssl32.dll
mk-ca-bundle.vbs
README
RELEASE-NOTES
_curlrc
Exception in thread "main" java.io.IOException: Cannot run program "curl" (in di
rectory "C:\Command Line Apps\cURL"): CreateProcess error=2, The system cannot f
ind the file specified

如您所见,curl.exe 存在于目录中。但 Runtime.exec() 似乎不认识它..

我该怎么做才能解决它?谢谢

4

1 回答 1

0

尝试使用不带空格的文件夹名称,例如使用 CommandLineApps 而不是“命令行应用程序”

于 2012-10-17T09:37:09.580 回答