public static void main(String[] args) throws IOException, InterruptedException {
// 执行ping命令
String cmdPing = "ping www.baidu.com";
Runtime run = Runtime.getRuntime();
Process process = run.exec(cmdPing);
process.waitFor();
BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream(), Charset.forName("GBK")));
String line = null;
while ((line = reader.readLine()) != null) {
System.out.println(line);
}
}
点触摸板就可以实现的功能干嘛要用原始的命令行?