Skip to content
Advertisement

ProcessBuilder gives a “No such file or directory” on Mac while Runtime().exec() works fine

I have an application, running on the Playframework, which needs to encode some video files. I used

JavaScript

for this (and it works perfectly), but as I need both, the output stream and the error stream, I am trying to use ProcessBuilder (as is also recommended).

But I cannot get it to work (testing on a MacBook). Is there a fundamental difference between the Runtime method and the ProcessBuilder?

This is my code for ProcessBuilder (exactly the same code works when replaced by Runtime.getRuntime().exec())

JavaScript

This is the console output:

JavaScript

Advertisement

Answer

You need to specify the arguments as separate Strings:

JavaScript

The constructor accepts String, varargs, and List<String>.

See ProcessBuilder documentation.

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement