Java 无法运行程序“..../abc.exe”:错误=13,权限被拒绝
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/27436972/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-11 04:22:45 来源:igfitidea点击:
Cannot run program "..../abc.exe": error=13, Permission denied
提问by
I am trying to execute the following code:
我正在尝试执行以下代码:
try
{
Runtime rt = Runtime.getRuntime() ;
Process p = rt.exec("/Users/abc/xyz.exe") ;
InputStream in = (InputStream) p.getInputStream() ;
OutputStream out = (OutputStream) p.getOutputStream();
InputStream err = (InputStream) p.getErrorStream() ;
System.out.println("in "+ in);
System.out.println("out" + out);
System.out.println("err" + err);
//do whatever you want
p.destroy() ;
}
catch(Exception e)
{
/*handle exception*/
e.printStackTrace();
throw new Exception("Error " + e.getMessage(), e.getCause());
}
and I am getting the following error :
我收到以下错误:
Cannot run program "/Users/abc/xyz.exe": error=13, Permission denied
I checked if I have the necessary permissions and found this via terminal:
我检查了我是否拥有必要的权限,并通过终端找到了这个:
-rw-r--r--@ 1 username staff 4016 Nov 22 23:12 /Users/abc/xyz.exe
Any suggestions on how to get this working?
有关如何使其工作的任何建议?
采纳答案by Adi
You need to change permission of xyz.exe
您需要更改 xyz.exe 的权限
chmod u+x /Users/abc/xyz.exe