[英]Cannot run program “/Applications/Utilities/Terminal.app”: error=13, Permission denied
I am currently experiencing substantial complications when running the code below: 我在运行以下代码时遇到了大量的复杂问题:
package practice;
import java.io.IOException;
public class ProgramExecutor {
public static void main (String [] args){
try{
Process p = Runtime.getRuntime().exec("/Applications/Utilities/Terminal.app");
} catch (IOException e){
e.printStackTrace();
}
}
}
It returns the following error message: 它返回以下错误消息:
java.io.IOException: Cannot run program "/Applications/Utilities/Terminal.app": error=13, Permission denied
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
at java.lang.Runtime.exec(Runtime.java:620)
at java.lang.Runtime.exec(Runtime.java:450)
at java.lang.Runtime.exec(Runtime.java:347)
at basicSkills.ProgramExecutor.main(ProgramExecutor.java:9)
Caused by: java.io.IOException: error=13, Permission denied
at java.lang.UNIXProcess.forkAndExec(Native Method)
at java.lang.UNIXProcess.<init>(UNIXProcess.java:185)
at java.lang.ProcessImpl.start(ProcessImpl.java:134)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
... 4 more
How would I go about resolving it. 我将如何解决它。 It appears to be due to a permission issue on my Mac.
这似乎是由于我的Mac上的权限问题。 I have changed the permissions in the Terminal using chmod command with little success.
我使用chmod命令更改了终端中的权限,但收效甚微。 What else could it be?
还有什么呢? Is it possible to run Eclipse as a super user in order to access this file?
是否可以以超级用户身份运行Eclipse以访问此文件?
The path '/Applications/Utilities/Terminal.app' is the path to the Terminal application, which is a directory. 路径'/Applications/Utilities/Terminal.app'是终端应用程序的路径,它是一个目录。 The actual executable Terminal program path is:
实际的可执行终端程序路径是:
/Applications/Utilities/Terminal.app/Contents/MacOS/Terminal
this is the path you need in the exec
call. 这是
exec
调用中需要的路径。
Alternatively use the 或者使用
open -n /Applications/Utilities/Terminal.app
command. 命令。
I was getting this error: java.io.IOException: Cannot run program "/filetransfer.pl": error=13, Permission denied 我收到此错误:java.io.IOException:无法运行程序“/filetransfer.pl”:错误= 13,权限被拒绝
I resolved the issue giving the permission to the filetransfer.pl script file to execute. 我解决了提供filetransfer.pl脚本文件执行权限的问题。 I use the terminal to execute the permission command.
我使用终端执行权限命令。 My problem is resolved.
我的问题解决了。
chmod 777 filetransfer.pl chmod 777 filetransfer.pl
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.