Iva
Iva

Reputation: 77

Run bash on android

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?

Upvotes: 0

Views: 569

Answers (1)

ramdroid
ramdroid

Reputation: 6798

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");

Upvotes: 3

Related Questions