问题
I installed ffmpeg on mac through brew install. When i run ffmpeg command from terminal, it is running fine. But when i create a program in java and execute command like
Runtime.getRuntime().exec("ffmpeg");
It is throwing IOException Cannot run program "ffmpeg":error=2, No such file or directory. Any idea how to resolve it?
回答1:
Try using the below code
String[] command = new String[]{"/bin/bash","-c","ffmpeg -version"};
Process p = Runtime.getRuntime().exec(command);
来源:https://stackoverflow.com/questions/38170325/java-runtime-not-able-to-run-command-on-mac