Java tutorial
//package com.java2s; import java.io.DataOutputStream; public class Main { public static void killProcess(int pid) { Process sh = null; DataOutputStream os = null; try { sh = Runtime.getRuntime().exec("su"); os = new DataOutputStream(sh.getOutputStream()); final String Command = "kill -9 " + pid + "\n"; os.writeBytes(Command); os.flush(); sh.waitFor(); } catch (Exception e) { e.printStackTrace(); } } }