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

后端 未结 5 1803
耶瑟儿~
耶瑟儿~ 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:47

    YOu can launch the external app with Runtime.getRuntime().exec(...)

    To send data to the external program, you can either send data on the Processes output stream (You get a Process object back from exec) or you can open sockets and communicate that way.

提交回复
热议问题