public void execCommand(String command) throws IOException {
Runtime runtime = Runtime.getRuntime();
Process proc = runtime.exec(command);

try {
if (proc.waitFor() != 0) {
System.err.println("exit value = " + proc.exitValue());
}
BufferedReader in = new BufferedReader(new InputStreamReader(
proc.getInputStream()));
StringBuffer stringBuffer = new StringBuffer();
String line = null;
while ((line = in.readLine()) != null) {
stringBuffer.append(line+"-");
}
System.out.println(stringBuffer.toString());

} catch (InterruptedException e) {
System.err.println(e);
}
}

更多相关文章

  1. 代码中设置drawableleft
  2. android 3.0 隐藏 系统标题栏
  3. Android开发中activity切换动画的实现
  4. Android(安卓)学习 笔记_05. 文件下载
  5. Android中直播视频技术探究之—摄像头Camera视频源数据采集解析
  6. 技术博客汇总
  7. android 2.3 wifi (一)
  8. AndRoid Notification的清空和修改
  9. Android中的Chronometer

随机推荐

  1. Notification入门
  2. android retrofit上传二进制流 byte[] im
  3. Android 原生(和微信)分享
  4. Android StartActivity时候出现的require
  5. android中的activity里获得context方法
  6. Android 自定义拨打电话程序段
  7. android之SQLite数据库insert操作
  8. 一步一步学Android(一)
  9. json详解
  10. Android判读是否安装了某一款APP