有什么方法可以启动命令'arp'。
我的尝试:
Runtime rt = Runtime.getRuntime();
proc = rt
.exec("arp")
-> 得到一个IOException
.exec("/proc/net/arp")
-> 也得到了一个IOException
(通过 adb shell 发现 a/proc/net/arp
存在)
还尝试了一个shell解决方案:
String sPrefix="/system/bin/sh -c 'proc/net/arp;";
String sPostfix="'";
Runtime rt = Runtime.getRuntime();
proc = rt.exec(sPrefix+sPostfix); // sh -c 'cd someplace; echo do something'
InputStreamReader reader = new InputStreamReader(proc.getInputStream());
BufferedReader buffer = new BufferedReader(reader);
String line = "";
while ((line = buffer.readLine()) != null) {
echo.append(line + "\n");
}
但没有返回值。
有没有人有想法:-/?