对于chmod命令,Java中的权限被拒绝错误 [英] Permission denied error in Java for chmod command

查看:882
本文介绍了对于chmod命令,Java中的权限被拒绝错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个可执行文件(ffmpeg),我正在尝试使用Mac上的Java程序运行。我使用Java程序将命令 chmod 777 / path /发送到/ ffmpeg ,但是当我尝试运行ffmpeg时,我收到以下错误:

I have an executable file (ffmpeg) that I'm trying to run with a Java program on a Mac. I used the Java program to send the command chmod 777 /path/to/ffmpeg, but when I try to run ffmpeg, I get the following error:

java.io.IOException: Cannot run program "/Users/james/WalkTheHall/ffmpeg": error=13, Permission denied

但是当我从 chmod 777 / path / to / ffmpeg 运行时在打开Java应用程序之前我自己的终端,ffmpeg的命令将在Java程序中运行得很好。

But when I run chmod 777 /path/to/ffmpeg from Terminal on my own before opening the Java application, the command to ffmpeg will run just fine in the Java program.

调用之间是否有区别? chmod 来自Java程序并自己调用它?为什么它不起作用?谢谢!

Is there a difference between calling chmod from within the Java program and calling it on my own? Why will it not work? Thank you!

推荐答案

我猜这个 chmod 是一个shell命令,而不是可执行文件。尝试通过shell运行 chmod 。在此处查看更多详细信息:想从Java调用linux shell命令

I'd guess that chmod is a shell command, not an executable. Try running chmod through your shell. See more details here: Want to invoke a linux shell command from Java

这篇关于对于chmod命令,Java中的权限被拒绝错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆