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

Popular posts from this blog

user interface - Python attempting to create a simple gui, getting "AttributeError: 'MainMenu' object has no attribute 'intro_screen'" -

jquery - Common JavaScript snippet to share files on Google Drive, Dropbox, Box.net or SkyDrive -

Android Gson.fromJson error -