java 调用cmd命令

public class Port{

    public static void main(String[] args) {


    Runtime runtime=Runtime.getRuntime();
    try{
    runtime.exec("cmd /c start ping www.baidu.com -t");
    }
    catch(Exception e){System.out.println("Error!");}


    }
}
 

 

posted @ 2015-07-30 14:01  fleam  阅读(206)  评论(0编辑  收藏  举报