Reputation: 11524
For a Java Process, I see a method to get the exit code, but how do I know when the process exited?
I'd like to fire an event when my Process is finished running...
Upvotes: 3
Views: 2308
Reputation: 40811
If you want to fire an event without stopping your current thread, start a thread that launches the process, calls waitFor(), and then fires the event when the time is right.
Thread.start(new Runnable() {
public void main() {
Process p = startProcess()
p.waitFor()
fireEvent()
}
})
Upvotes: 8