Read from another process' output stream

后端 未结 2 1861
礼貌的吻别
礼貌的吻别 2021-01-21 21:59

i wanted to read the output-stream of a c-Application in my Java program. iremoted (available here: http://osxbook.com/software/iremoted/download/iremoted.c) is a C-App

2条回答
  •  醉梦人生
    2021-01-21 22:37

    iremoted is likely writing to stderr if a hello world program works. You would want the error stream in that case. I'm not sure how this works for your hello world case - I think you're doing the wrong thing here:

     new InputStreamReader(process.getInputStream()); 
    

    should be

     new InputStreamReader(process.getOutputStream());
    

    or

     new InputStreamReader(process.getErrorStream());
    

提交回复
热议问题