Java tutorial
//package com.java2s; import java.io.DataOutputStream; import java.io.IOException; public class Main { public static Process execRuntimeProcess(String cmd) { Runtime localRuntime = Runtime.getRuntime(); try { Process pro = localRuntime.exec("su"); DataOutputStream out = new DataOutputStream(pro.getOutputStream()); out.writeBytes(cmd + " \n"); return pro; } catch (IOException e) { e.printStackTrace(); } return null; } }