Run external program concurrently and communicate with it through stdin / stdout

后端 未结 5 1813
耶瑟儿~
耶瑟儿~ 2020-12-06 07:17

I want to be able to run an external program concurrently with my Java code, i.e. I want to start the program, then return control to the calling method while keeping the ex

5条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-06 07:57

    I second the answer about using ProcessBuilder. If you want to know more details about this, and why you should prefer it to Runtime.exec(), see this entry in the Java glossary. It also shows how to use threads to communicate with the external process.

提交回复
热议问题