0

Hi I am trying for root check of android device I am using following code to check whether the device is rooted or not but bit confused,

public static enum SHELL_CMD {
check_su_binary(new String[] { "/system/xbin/which", "su" });

String[] command;

SHELL_CMD(String[] command) {
    this.command = command;
}}

For checking binary SU in this code when I run the code with "/system/xbin/which" code shows me device is rooted(command run successfully), but if I remove "which"(i.e. "/system/xbin/") and run the code it throws me an exception that access denied.

Is there any specific significance of "/which" in rooting android device. I am running this code in CyanogenMod 11S(One Plus device) Thank you In advance

1

/system/xbin/which is the path of a program this script needs to execute (run). /system/xbin/ is a directory, so obviously you can't execute it.

If you've never used the which command on your desktop GNU/Linux system, you might be interested to read its manpage. In this case, the script is using it to find out if the su command exists, and the actual program it will run.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.