Chinaunix首页 | 论坛 | 博客
  • 博客访问: 83618
  • 博文数量: 13
  • 博客积分: 1457
  • 博客等级: 上尉
  • 技术积分: 135
  • 用 户 组: 普通用户
  • 注册时间: 2006-11-25 08:14
文章分类

全部博文(13)

文章存档

2010年(1)

2008年(12)

我的朋友

分类:

2008-11-10 21:28:49


import java.io.*;
import java.lang.*;

public class Ping {
    
    public Ping() {
    }
    public static void main(String args[])
    {
        if (args.length < 1)
        {
            System.out.println("syntax Error!");
        }
        else
        {
            String line = null;
            try
            {
                Process pro = Runtime.getRuntime().exec("ping " + args[0]);
                BufferedReader buf = new BufferedReader(new InputStreamReader(pro.getInputStream()));
                while((line = buf.readLine()) != null)
                    System.out.println(line);
            }
            catch(Exception ex)
            {
                System.out.println(ex.getMessage());
            }
        }
        
    }
}
阅读(668) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~