0
構建目錄和文件我的應用程序具有根權限,我想使用代碼在/ system或其他目錄設備上創建目錄或文件。如何在/系統文件中使用代碼
我知道常見的Java構建文件爲:
File file = new File(destFileName);
if (file.exists()) {
return false;
}
,如果我能像上面的代碼建立在系統目錄。如果我需要構建文件目錄之前使用su命令
Process p = null;
p = Runtime.getRuntime().exec("su");
編輯? :我已閱讀Create a file in /system directory,但我不能使用代碼寫:
" hint: use the "adb shell" and check if the upper steps can lead to success (su && remount -o remount,rw /system && touch /system/test)"
如何使用代碼? – pengwang
這段代碼是shell命令。 – Tishka17
我想使用java代碼來執行shell命令 – pengwang