java cmd execute
Read cup info
public static String fetch_cpu_info() {
String result = null;
CMDExecute cmdexe = new CMDExecute();
try {
String[ ] args = { “/system/bin/cat”, “/proc/cpuinfo” }
result = cmdexe.run(args, “/system/bin/”);
Log.i(”result”,”result=” + result);
} catch (IOException ex) {
ex.printStackTrace();
}
return result;
}
java.lang.Process p = Runtime.getRuntime().exec(cmdStrings);
BufferedReader in = new BufferedReader(new InputStreamReader(p.getInputStream()));
String line = null;
while ((line = in.readLine()) != null) {
Slog.v("Jason", line + "/n");
}
BufferedReader in2 = new BufferedReader(new InputStreamReader(p.getErrorStream()));
while ((line = in2.readLine()) != null) {
Slog.v("Jason", "error " + line + "/n");
}
p.waitFor();
ps:下面的返回值必須及時的讀出,否則會形成堵塞,後面的執行不到
p.getInputStream()
p.getErrorStream()
From:
http://blog.csdn.net/fuuckwtu/article/details/6366912
public static String fetch_cpu_info() {
String result = null;
CMDExecute cmdexe = new CMDExecute();
try {
String[ ] args = { “/system/bin/cat”, “/proc/cpuinfo” }
result = cmdexe.run(args, “/system/bin/”);
Log.i(”result”,”result=” + result);
} catch (IOException ex) {
ex.printStackTrace();
}
return result;
}
java.lang.Process p = Runtime.getRuntime().exec(cmdStrings);
BufferedReader in = new BufferedReader(new InputStreamReader(p.getInputStream()));
String line = null;
while ((line = in.readLine()) != null) {
Slog.v("Jason", line + "/n");
}
BufferedReader in2 = new BufferedReader(new InputStreamReader(p.getErrorStream()));
while ((line = in2.readLine()) != null) {
Slog.v("Jason", "error " + line + "/n");
}
p.waitFor();
ps:下面的返回值必須及時的讀出,否則會形成堵塞,後面的執行不到
p.getInputStream()
p.getErrorStream()
From:
http://blog.csdn.net/fuuckwtu/article/details/6366912
相關文章
- Java執行cmd命令Java
- Java執行shell、cmd命令Java
- Java執行緒池中的execute和submitJava執行緒MIT
- The Execute Disable/No Execute CPU feature is not enabled for this machineMac
- cmd下檢視java位元組碼Java
- JAVA 程式 在 cmd 視窗的執行Java
- VMware: ESXi requires the Execute Disable/No Execute CPU feature to be enabledUI
- CMD
- android錯誤unable to execute dex java heap space解決方案AndroidJava
- Execute to Parse 指標指標
- Java呼叫db2cmd命令匯出資料JavaDB2
- -bash: /tyrone/jdk/jdk1.8.0_91/bin/java: cannot execute binary fileJDKJava
- Unable to execute dex: java.nio.BufferOverflowException. Check the Eclipse log for stack trace.JavaExceptionEclipse
- CMD模板
- app:processReleaseResources, Failed to execute aaptAPPAIAPT
- 理解EXECUTE_TO_PARSE(二)
- 理解EXECUTE_TO_PARSE(一)
- EXECUTE IMMEDIATE dynamic sql in procedureSQL
- ExecutorService之submit與executeMIT
- SQL can execute in wrong SchemaSQL
- 配置好JDK後,如何在cmd下執行java程式JDKJava
- dns cmd 修改DNS
- 常用 cmd 命令
- i_init_func_execute_data
- AWR Execute to Parse引數解析
- execute shell script from stored procedure
- EXECUTE DBMS_LOGSTDBY.BUILDUI
- execute immediate 語法小結
- cmd 命令列 命令命令列
- Python cmd模組Python
- CMD命令 彙總
- CMD命令手冊
- Apache httpclient的execute方法除錯ApacheHTTPclient除錯
- 載入驅動三種execute
- execute immediate的簡單用法(oracle)Oracle
- 11g DBMS_PARALLEL_EXECUTEParallel
- revoke EXECUTE privileges on powerful packages from PUBLICPackage
- 在QTP中使用Eval與ExecuteQT