hummmingbear
hummmingbear

Reputation: 2394

Execute shell script from android studio

I'm writing some tests in Android Studio with Robotium. In my test file I'd like to execute a shell script that prepares the right environment on our server. I don't work in Java/AndroidStudio so this is completely new territory. Is it possible to execute a shell script?

I found some code, but java doesn't recognize commandLine

commandLine 'sh', './myScript.sh'

Any help greatly appreciated.

Upvotes: 2

Views: 5195

Answers (1)

hummmingbear
hummmingbear

Reputation: 2394

ProcessBuilder pb = new ProcessBuilder("myshellScript.sh", "myArg1", "myArg2"); will do the trick

Upvotes: 3

Related Questions