The class in which the ProcessBuilder object is formed:

public class MpcRunner { private String Mpc; private String path; private String displayNumber; private String port; private final String webport = "/webport "; private final String monitor = "/monitor "; private final String fullscreen = "/fullscreen"; public MpcRunner(String mpc, String path, String displayNumber, String port) { this.Mpc = mpc; this.path = path; this.displayNumber = displayNumber; this.port = port; } public String getPort() { return port; } public void run() throws IOException, InterruptedException { ProcessBuilder mpcProc = new ProcessBuilder(Mpc,path,monitor+displayNumber); Process process = mpcProc.start(); process.waitFor(); }} 

Called constructor:

 public static void main(String[] args) throws IOException, InterruptedException { MpcRunner mpcRunner = new MpcRunner("C:\\Program Files\\MPC-HC\\mpc-hc64.exe","C:\\video1.mp4","1","55555"); mpcRunner.run();} 

When trying to create a process with the attributes / monitor and / or / webport mpc-hc enter image description here

When transferring a command, to the command line, MPC-HC runs correctly.

Media Player Classic - Home Cinema (64-bit)

Build information: Version: 1.7.10 (d911f14) Compiler: MSVC 2013 Update 5 Build date: Nov 14 2015 18:25:24

    1 answer 1

    As it turned out, all switches must be passed as one command:

     public void run() throws IOException, InterruptedException { ProcessBuilder mpcProc = new ProcessBuilder(Mpc,path+" "+monitor+displayNumber); Process process = mpcProc.start(); process.waitFor(); } 

    Alas, I haven’t found out why.