I have a program in java. The program opens Windows calculator with Runtime.exec. So far so good, but I need that when program is closed by a user, a message appears saying "Program has been closed successfully".
I make it with destroy() but that isn't what I need.
You have to call
waitFor()
on theProcess
return byexec()
. This will wait for the thread to end, and will return the exit value that you can test (0
is a successful exit value, everything else is an unsuccessful exit value).