Java run async processes

前端 未结 3 813
野趣味
野趣味 2020-12-19 05:10

I am trying to run an async process and I do not want the program to wait until the end of these processes executions. I found this question how to run shell script asynchro

3条回答
  •  时光取名叫无心
    2020-12-19 05:53

    You are reading the output streams of your process, and thats the reason your java program does not exit:

            printStream(process.getErrorStream(), true);
            printStream(process.getInputStream(), true);
    

    Your stream reading will keep blocking your code.

    You may like to redirect output of your launched process to a log file and read that later.

提交回复
热议问题