I also try to do something(a command, not a script) with system(), it always does not work. system() return value is 256(-1),
according to ./bionic/libc/unistd/system.c is that means fork() error? On Feb 12, 9:52 am, Dan Bornstein <danf...@android.com> wrote: > On Wed, Feb 11, 2009 at 4:54 AM, Corey <uvic2...@gmail.com> wrote: > > Currently I am trying to write an application in Android GUI. > > One of the function will need to call one of the shell script in / > > system/xbin/. > > I write an API in C by using system("/system/xbin/test.sh"); funtion, > > and then my Java code will use this c API code to execute this shell > > script. > > However, it seems nothing happens. > > Can I call a shell script from JNI? > > It's not clear to me that you need to use native code at all. If you > need it for some other reason, then ignore this. > > You can use one of the several Runtime.exec() methods or the > ProcessBuilder class to execute scripts (and binaries for that > matter), directly from your high-level code. > > -dan --~--~---------~--~----~------------~-------~--~----~ unsubscribe: android-porting+unsubscr...@googlegroups.com website: http://groups.google.com/group/android-porting -~----------~----~----~----~------~----~------~--~---