0

I try run bash on android using next code:

    Process proc = null;

    try 
   {
        proc = Runtime.getRuntime().exec("/bin/bash");                      

    } catch (IOException e) 
   {
        e.printStackTrace();
   }
   if (proc != null)
   {
    //some code
   }else
    System.out.println("NULL");

But proc always is null. What I do wrong?

Iva
  • 75
  • 2
  • 10

1 Answers1

3

Bash is usually not available on Android devices, and the location of the bin directory is different too. Try this one:

proc = Runtime.getRuntime().exec("/system/bin/sh");
ramdroid
  • 6,738
  • 1
  • 16
  • 14