Why not work exec?

I have a code:
String[] cmd = new String[] {"su", "./php lol.php"}; 
Runtime.getRuntime().exec(cmd);

On the php file defines the rights of rwx, in the emulator terminal Android a php script run with a Bang, and in application no.
July 2nd 19 at 17:22
2 answers
July 2nd 19 at 17:24
su you have, of course, the phone have? :)
Of course, root is. Busybox too - Werner_Treutel41 commented on July 2nd 19 at 17:27
: www.stealthcopter.com/blog/2010/01/android-request... - Montana_Abshire commented on July 2nd 19 at 17:30
: as a matter of fact, I don't need root there. The php file is rwx. Ie it can be done. - Werner_Treutel41 commented on July 2nd 19 at 17:33
: haha then su if root is not needed?! - Montana_Abshire commented on July 2nd 19 at 17:36
: this run differently, but the point is, not running exec from php file and in the terminal rules - Werner_Treutel41 commented on July 2nd 19 at 17:39
July 2nd 19 at 17:26
try {
 Process process = Runtime.getRuntime().exec("./php lol.php");
 BufferedReader reader = new BufferedReader(
 new the InputStreamReader(process.getInputStream()));
 int read;
 char[] buffer = new char[4096];
 StringBuffer output = new StringBuffer();
 while ((read = reader.read(buffer)) > 0) {
 output.append(buffer, 0, read);
}
reader.close();
process.waitFor();
 return output.toString();
 } catch (IOException e) {
 throw new RuntimeException(e);
 } catch (InterruptedException e) {
 throw new RuntimeException(e);
 }


and check out that .You have correctly specified the path

Find more questions by tags Android