title: Having spaces in Runtime.getRuntime().exec with 2 executables
body: <p>I have a command that I need to run in java along these lines:</p>
  
  <pre><code>    C:\path\that has\spaces\plink -arg1 foo -arg2 bar "path/on/remote/machine/iperf -arg3 hello -arg4 world"
  </code></pre>
  
  <p>This command works fine when the path has no spaces, but when I have the spaces I cannot seems to get it to work. I have tried the following things, running Java 1.7</p>
  
  <pre><code>String[] a = "C:\path\that has\spaces\plink", "-arg1 foo", "-arg2 bar", "path/on/remote/machine/iperf -arg3 hello -arg4 world"
  Runtime.getRuntime().exec(a);
  </code></pre>
  
  <p>as well as</p>
  
  <pre><code>String[] a = "C:\path\that has\spaces\plink", "-arg1 foo", "-arg2 bar", "path/on/remote/machine/iperf", "-arg3 hello", "-arg4 world"
  Runtime.getRuntime().exec(a);
  </code></pre>
  
  <p>But neither seem to be doing anything. Any thoughts on what i am doing wrong??</p>