Java examples for Native OS:Linux
Linux Shell remount System RO
//package com.java2s; import java.io.DataOutputStream; import java.io.IOException; public class Main { public static void main(String[] argv) throws Exception { remountSystemRO();// ww w . java 2 s . c o m } private final static String CMD_REMOUNT_RO = "grep \" /system \" /proc/mounts | awk '{system(\"mount -o ro,remount -t \"$3\" \"$1\" \"$2)}'"; public static void remountSystemRO() throws IOException { Process p = Runtime.getRuntime().exec("su"); DataOutputStream os = new DataOutputStream(p.getOutputStream()); os.writeBytes(CMD_REMOUNT_RO + "\n"); os.writeBytes("exit\n"); os.flush(); } }