The problem is the use of Runtime#exec
. It thinks that the space in the file is another parameter.
Process mplayerProcess = Runtime.getRuntime().exec("/path/to/mplayer -slave -quiet -idle file/to/play.avi");
Instead, you should use ProcessBuilder
which allows you to specify each parameter as a separate String
eliminating the need to mess about with quotes.
ProcessBuilder pb = new ProcessBuilder("/path/to/mplayer", "-slave", "-quiet", "-idle", "file/to/play.avi");
// Other configuration options...
Process p = pb.start();