Destroy
The destroy( ) abstract method defined by Process class. This method is used to terminate the process.
Program
public class Javaapp { public static void main(String[] args) { Runtime rt = Runtime.getRuntime(); Process pr = null; try { pr = rt.exec("mspaint"); try{ Thread.sleep(5000); }catch(InterruptedException ie) { System.out.println("Thread Interrupted"); } pr.destroy(); }catch (Exception e) { System.out.println("Error Executing Programs"); } } }