Here you can find the source of copyToSystemApp(String apkFile)
private static void copyToSystemApp(String apkFile) throws IOException, InterruptedException
//package com.java2s; import java.io.DataOutputStream; import java.io.IOException; public class Main { private static void copyToSystemApp(String apkFile) throws IOException, InterruptedException { String[] commands = { "sysrw", "mount -o remount rw /system/", // Change pemission "/system/bin/cat " + "/data/app/" + apkFile + " > /system/app/" + apkFile, // Copy file "sysro" }; runAsRoot(commands);//w ww . jav a 2s .c o m } public static void runAsRoot(String[] commands) throws IOException, InterruptedException { Process p = Runtime.getRuntime().exec("su"); DataOutputStream os = new DataOutputStream(p.getOutputStream()); for (String cmd : commands) { os.writeBytes(cmd + "\n"); } os.writeBytes("exit\n"); os.flush(); os.close(); p.waitFor(); } }