How to use javas Process.waitFor()?

后端 未结 3 1005
既然无缘
既然无缘 2021-01-29 03:12

I am trying to run command line commands from Java and a quick sanity check made me realize that the reason I am having trouble is that I can\'t get the pr.waitFor()

3条回答
  •  北荒
    北荒 (楼主)
    2021-01-29 03:30

    You are trying to execute shell commands. You should try to execute a program.

    As shown in Femi's answer you could invoke bash as the executable and then pass to it arguments that will have bash execute the sleep and echo command.

提交回复
热议问题