Wait for process to finish before proceeding in Java

后端 未结 4 1298
無奈伤痛
無奈伤痛 2020-12-01 18:24

Essentially, I\'m making a small program that\'s going to install some software, and then run some basic commands afterwards to prep that program. However, what is happening

4条回答
  •  鱼传尺愫
    2020-12-01 19:25

    you can use Process.waitFor() method

    and the doc says

    Causes the current thread to wait, if necessary, until the process represented by this Process object has terminated. This method returns immediately if the subprocess has already terminated. If the subprocess has not yet terminated, the calling thread will be blocked until the subprocess exits.

提交回复
热议问题