JAVA_Runtime

package com.kk.array;

import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;

public class RunTimeTest {
public static void main(String[] args) {
try {
Process process =Runtime.getRuntime().exec("ping www.baidu.com");
InputStream in=process.getInputStream();
InputStreamReader sr=new InputStreamReader(new BufferedInputStream(in));
int data;
while((data=sr.read())!=-1)
System.out.print((char)data);
} catch (IOException e) {
e.printStackTrace();
}
}
}
posted @ 2011-12-23 15:00  microsoft_kk  阅读(179)  评论(0编辑  收藏  举报