java - How to check if process is running -
processbuilder pb = new processbuilder("notepad"); process p = pb.run(); system.out.println("notepad closed") the code above run fine , open notepad. print statement not print until manually close notepad window. because java waits until process terminated. there anyway can open process , check if window has loaded?
the processbuilder.start() method not halt program execution.
you can use this:
processbuilder pb = new processbuilder("notepad"); process p = pb.start(); system.out.println("this print right after notepad launched.") you can use process object read output program, kill program, or halt program execution until finished.
here reference page: process
Comments
Post a Comment