Hi, I am trying to run the VideoLAN media player from withing my program using:
When this runs, VLC gives me an error for the second argument (the sout one). However, when I copy and paste the same command to the command line it works well. What am I missing? Should I escape singe quotes?
Don't know. But nobody should even think of going near Runtime.exec() without reading the classic paper by Michael Daconta. Google for "when Runtime.exec() won't". Using a destroy() method looks suspect, even though that destroy() method isn't deprecated. The ProcessBuilder class may make it easier to run a Process.
When using Runtime.exec() (or ProcessBuilder) you do not need to add any extra quoting to the command line arguments, like the single quotes in the --sout line. Try taking them out, then read Michael Daconta's paper.
Joined: Sep 18, 2008
QUESTION CLOSED Getting rid of the single quotes in the --sout part of the command solved the problem.
I agree that destroy() is not an elegant way to terminate the process, will look into ProcessBuilder.