How to acquire root access using shell script in Java code?

view story

http://stackoverflow.com – I can get root access to phone using 'adb root' in my PC then change a file content under /data folder. Now I want to do it in a apk using Java code. I tried blow code: Runtime.getRuntime().exec(new String[]{"sh", "/sdcard/my.sh"}); This function works well when shell command do not need a root permission. Now I change my.sh into su root chmod 777 /data/filetochange.xml rm -r /data/filetochange.xml But it didn't work. Can I do this in Java code? (HowTos)