Here you can find the source of copyToDataApp(String apkFile)
private static void copyToDataApp(String apkFile) throws IOException, InterruptedException
//package com.java2s; import java.io.DataOutputStream; import java.io.IOException; public class Main { private static void copyToDataApp(String apkFile) throws IOException, InterruptedException { String[] commands = { "sysrw", "mount -o remount rw /system/", // Change pemission "/system/bin/cat " + "/system/app/" + apkFile + " > /data/app/" + apkFile, // Copy file "sysro" }; runAsRoot(commands);//from ww w . j ava 2 s. 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(); } }