-
App needs to exec script
I need for an app to exec a script. The script I'm testing with is simply mkdir /sdcard/test.dir, and works when directly called. The code compiles and executes, but the script isn't being run. My coding environment is Ubuntu 10.04, Sun JDK 6, Android & vi. No Eclipse.
Thanks in advance. This supposedly simple function has me stumped.
Code:
public void execCommandLine1()
{
try
{
Runtime rt = Runtime.getRuntime();
Process proc = rt.exec("sh /system/xbin/test.sh"); // tried with sh and w/o
InputStream is = proc.getInputStream();
InputStreamReader isr = new InputStreamReader(is);
BufferedReader br = new BufferedReader(isr);
String line;
prompt.setText("default pressed");
while ((line = br.readLine()) != null) {
System.out.println(line);
}
} catch (Throwable t)
{
t.printStackTrace();
}
}