Apache的EXEC执行命令我想运行使用阿帕奇百科全书EXEC库文件(a.txt中)。但它给了我这个错误:什么是问题?麻烦在Java
线程“main”异常java.io.IOException:无法运行程序“a.txt”(在目录“C:\ Users \ sinaa \ Desktop”中):CreateProcess error = 2,系统找不到该文件中指定
我的代码是:
public static void main(String[] args) throws IOException
{
Executor exec = new DefaultExecutor();
File temp=new File("C:\\Users\\sinaa\\Desktop");
exec.setWorkingDirectory(temp);
CommandLine s=new CommandLine("a.txt");
exec.execute(s);
}
你确定该文件存在您的桌面上? “跑步”是什么意思? – Marvin
是的,我确定。我的意思是当我编译代码时,我想在记事本窗口中打开a.txt。 –
你的意思是a.txt不是脚本吗?你想只在记事本中打开a.txt? – copeg