首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 操作系统 > UNIXLINUX >

Android开发片断–JAVA执行LInux脚本

2012-07-29 
Android开发片段–JAVA执行LInux脚本/* * シェルスクリプトを運行 */public String exec(String command) {StringBuf

Android开发片段–JAVA执行LInux脚本

/* * シェルスクリプトを運行 */public String exec(String command) {StringBuffer output = new StringBuffer();Log.d("exec", command);try {Process process = Runtime.getRuntime().exec(command);DataInputStream stdout = new DataInputStream(process.getInputStream());String line;while ((line = stdout.readLine()) != null) {output.append(line).append('\n');}process.waitFor();} catch (Exception e) {PACERUtil.setLog("JAVA-ERROR", versionOld, "SHELL ERROR", storeCD, IP, macAddress);finish();}return output.toString();}
?

热点排行