我正在尝试在 ubuntu 的主目录中启动一个进程。我不断收到权限被拒绝的异常,我不知道为什么。这是代码:
Process p = null;
ProcessBuilder pb = new ProcessBuilder("/home");
p = pb.start();
这是一个例外:
Exception in thread "main" java.io.IOException: Cannot run program "/home":
java.io.IOException: error=13, Permission denied
at java.lang.ProcessBuilder.start(ProcessBuilder.java:475)
at tester.Main.main(Main.java:30)
Caused by: java.io.IOException: java.io.IOException: error=13, Permission denied
at java.lang.UNIXProcess.<init>(UNIXProcess.java:164)
at java.lang.ProcessImpl.start(ProcessImpl.java:81)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:468)
... 1 more
Java Result: 1