Results 1 to 1 of 1
Thread: App needs to exec script
- 07-06-2012, 04:51 AM #1
Member
- Join Date
- Jul 2012
- Posts
- 1
- Rep Power
- 0
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.
Java 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(); } }
Similar Threads
-
UTF-8 from an Exec
By Grismar in forum New To JavaReplies: 2Last Post: 12-12-2012, 12:18 PM -
runtime.exec
By cotede2 in forum Advanced JavaReplies: 3Last Post: 04-17-2009, 05:18 PM -
help with Runtime.exec()
By Lanfear in forum New To JavaReplies: 18Last Post: 12-16-2008, 11:09 AM -
Runtime.exec()
By hknyo in forum Advanced JavaReplies: 2Last Post: 08-16-2008, 12:40 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks