title: Print output of c++ .exe file in java
body: <p>I want to run c++ .exe file from java and also want to print the output of .exe file.i tried and succeed to run c++ .exe file from java ,but i am not getting how can i print the output(in java output field) of c++ .exe file using java,i tried using processExitValue and waitfor  methods but not getting desired output.The java code is here </p>
  
  <pre><code>int processExitVal = 0;
           try {
          Process p = Runtime.getRuntime().exec("cmd /c  start rs.exe");
          processExitVal = p.waitFor();
         // p.getOutputStream();
          //InputStreamReader ir=new InputStreamReader(p.getInputStream());
         //BufferedReader t = new BufferedReader((new InputStreamReader(p.getInputStream())));
         // int y=Integer.parseInt(t.readLine());
          InputStream in=p.getInputStream();
          System.out.println(in.read());
          //System.out.println("output"+Process.getOutputStream());
          } catch (IOException e) {
          System.out.println("IOException");
          e.printStackTrace();
          } catch (InterruptedException e) {
          System.out.println("InterruptedException");
          e.printStackTrace();
         }
         System.out.println(processExitVal);
         System.out.println("Execution complete");
  }
  </code></pre>
  
  <p>I will be thankful if u will help me out this problem. Thanks in advance </p>