title: Call an executable and pass parameters
body: <p>I'm figuring out a mechanism to call an exe from Java and passing in specific parameters. How can I do?</p>
  
  <pre><code>Process process = new ProcessBuilder("C:\\PathToExe\\MyExe.exe").start();
  InputStream is = process.getInputStream();
  InputStreamReader isr = new InputStreamReader(is);
  BufferedReader br = new BufferedReader(isr);
  String line;
  
  System.out.printf("Output of running %s is:", Arrays.toString(args));
  
  while ((line = br.readLine()) != null) {
    System.out.println(line);
  }
  </code></pre>
  
  <p>The previous code works. <strong>But I'm not able to pass parameters in</strong>. MyExe.exe accepts parameters. An other problem is when PathToExe has blank spaces. ProcessBuilder seems not working. For example:</p>
  
  <pre><code>C:\\User\\My applications\\MyExe.exe
  </code></pre>
  
  <p>Thank you.</p>