How to make pipes work with Runtime.exec()?

后端 未结 4 1492
日久生厌
日久生厌 2020-11-22 03:35

Consider the following code:

String commandf = \"ls /etc | grep release\";

try {

    // Execute the command and wait for it to complete
    Process child =         


        
4条回答
  •  悲哀的现实
    2020-11-22 03:53

    Create a Runtime to run each of the process. Get the OutputStream from the first Runtime and copy it into the InputStream from the second one.

提交回复
热议问题