title: Processbuilder to execute jar files with arguement
body: <p>I would like to execute a jar file with some arguements using ProcessBuilder, but I am not sure how to construct the syntax.</p>
  <p>For example, I wanted to execute the following :</p>
  <pre><code>processBuilder.command(&quot;cmd.exe&quot;, &quot;/c&quot;, &quot;java&quot; ,&quot;-jar&quot; + this.jar_filepath + &quot; &quot; + this.tc_name + &quot; &quot; + this.test_data + &quot; &quot; + this.test_result);
  </code></pre>
  <p>Basically, I am trying to execute a jar file located at <code>jar_filepath</code> and sending the content of the arguments <code>tc_name, test_data</code> and <code>test_result</code> to the main method of the executed jar files.</p>
  <p>This is obviously wrong, which I hope to have guidance on how to properly construct the syntax.</p>
  <p><strong>UPDATE:</strong>
  For KevinBoone:</p>
  <pre><code> try {
        Process process = processBuilder.start();
        process.waitFor()  ;
        BufferedReader reader = new BufferedReader(new 
                                InputStreamReader(process.getInputStream()));
  
        String line;
        while ((line = reader.readLine()) != null) {
             System.out.println(line);
        }
  
        int exitCode = process.waitFor();
        System.out.println(&quot;\nExited with error code : &quot; + exitCode);
  }
  catch (IOException e) {
        e.printStackTrace();
  } 
  catch (InterruptedException e) {
        e.printStackTrace();
  }
  </code></pre>