java - Finding out when the close button in notepad is clicked -


i need open notepad @ runtime. of processbuilder.

processbuilder pb = new processbuilder("notepad.exe" , "file.txt"); pb.start(); 

after notepad opens, type in stuff , when click close button. want java program recognize , continue rest of program. know

thread.sleep(*some long value*)  

but think program more efficient if recognizes when notepad.exe closes.

do :-

processbuilder pb = new processbuilder("notepad.exe" , "file.txt"); process pro = pb.start(); int val = pro.waitfor(); 

with process pro wait complete execution, val should 0 normal termination, according convention.

for getting file path:

this file.txt created @ current directory. in order current directory path, can use :-

file f = new file("."); string path = f.getcanonicalpath();


Comments

Popular posts from this blog

c# - Better 64-bit byte array hash -

webrtc - Which ICE candidate am I using and why? -

php - Zend Framework / Skeleton-Application / Composer install issue -