import java.io.IOException;
import java.io.InputStreamReader;
public class GetRuntimeTest {
public static void main(String[] args) {
Process p=null;
try {
p = Runtime.getRuntime().exec(
"C:/windows/system32/ping.exe programcreek.com");
} catch (IOException e) {
e.printStackTrace();
}
//get process input stream and put it to buffered reader
BufferedReader input = new BufferedReader(new InputStreamReader(
p.getInputStream()));
String line;
try {
while ((line = input.readLine()) != null) {
System.out.println(line);
}
} catch (IOException e) {
e.printStackTrace();
}
try {
input.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
댓글 없음:
댓글 쓰기