[英]Cannot run program “…/abc.exe”: error=13, Permission denied
我正在嘗試執行以下代碼:
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());
}
我收到以下錯誤:
Cannot run program "/Users/abc/xyz.exe": error=13, Permission denied
我檢查了我是否擁有必要的權限並通過終端找到了這個:
-rw-r--r--@ 1 username staff 4016 Nov 22 23:12 /Users/abc/xyz.exe
有關如何使這項工作的任何建議?
您需要更改xyz.exe的權限
chmod u+x /Users/abc/xyz.exe
你沒有該文件的執行權限。 您需要更改該文件的執行權限。它只包含讀取和寫入。 請參考這里更改權限
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.