So for example:
Runtime rt = Runtime.getRuntime();
creates Runtime rt
Process p1 = rt.exec("C:/Windows/System32/calc.exe");
creates Process p1
on Runtime rt
.
Then p1.destroy();
will destroy Process p1
.
My question is: If I have more than one Process
(e.g. p1
, p2
, and p3
), how do I destroy them all at once, instead of having to destroy them one by one?