标签:android
1 在linux和windows中使用不同的命令打开窗口,比如使用adb 时,linux要用:
Runtime.getRuntime().exec(new String[] {"/bin/sh","-c",cmd});
而windows会用
Runtime.getRuntime().exec(new String[] {"cmd","/c",cmd});,
如果都用/bin/bash,会报以下错误:
java.io.IOException: Cannot run program "/bin/bash": CreateProcess error=2, The system cannot find the file specified
at java.lang.ProcessBuilder.start(Unknown Source)
at java.lang.Runtime.exec(Unknown Source)
at java.lang.Runtime.exec(Unknown Source)
2
标签:android
原文地址:http://yingerfei.blog.51cto.com/3296071/1737367