android - java.io.IOException: Error running exec(). Commands: [cd, sdcard/.yasmin] Working Directory: null Environment: null -


i try access folder in sdcard , install myapp.apk, use code:

 runtime.getruntime().exec("cd sdcard/.yasmin");  runtime.getruntime().exec("adb install tefli.apk"); 

but unfortunatelly have error:

05-11 11:09:57.925: warn/system.err(1399): java.io.ioexception:  error running exec(). commands: [cd, sdcard/.yasmin] working directory: null    environment: null 

anybody please have idea. in advance.

i not sure fix problem, afaik, each call exec() creates new shell. possible solution following:

  1. get process of exec() using: process p = runtime.getruntime().exec(...).
  2. grab process inputstream using p.getinputstream();.
  3. run second command.

also note trying access sdcard in root folder , in hardcoded path, consider following:

process p = runtime.getruntime().exec("cd /sdcard/.yasmin"); 

or better:

process p = runtime.getruntime().exec("cd " + environment.getexternalstoragedirectory() + "/.yasmin"); 

hope it'll help!


Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -