本帖最后由 刘海陆 于 2013-4-18 21:40 编辑
import java.io.*;
class FileDemo
{
public static void main(String[] args) throws Exception
{
//System.out.println("Hello World!");
File f = new File("1.txt");
f.createNewFile();
Runtime r = Runtime.getRuntime();
r.exec("1.txt");
}
}
下面是运行的报错信息,
Exception in thread "main" java.io.IOException: Cannot run program "1.txt": Crea
teProcess error=193, %1 ??????Ч?? Win32 ??ó
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
at java.lang.Runtime.exec(Runtime.java:615)
at java.lang.Runtime.exec(Runtime.java:448)
at java.lang.Runtime.exec(Runtime.java:345)
at FileDemo.main(FileDemo.java:13)
Caused by: java.io.IOException: CreateProcess error=193, %1 ??????Ч?? Win32 ??ó
at java.lang.ProcessImpl.create(Native Method)
at java.lang.ProcessImpl.<init>(ProcessImpl.java:189)
at java.lang.ProcessImpl.start(ProcessImpl.java:133)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1021)
... 4 more
没明白,求解
|