有必要用Ping命令吗?
你想得什么信息?

解决方案 »

  1.   

    //File:LoadWinApp.java
    //Memo:在Java中执行外部的应用,详见《程序员》2003.07 P105-6import java.lang.*;
    import java.io.*;public class LoadWinApp
    {
        public static void main(String args[]) throws IOException
        {
            Runtime r = Runtime.getRuntime();
            Process p = null;
            String strWinApp = "cmd start";
            String strWinFile = "NotePad.exe";        if(args.length > 1)
            {
                strWinApp = args[0];
                strWinFile = args[1];
            }
            try
            {
                //p = r.exec(strWinApp);
                p = r.exec(strWinApp + " " + strWinFile);
            }
            catch(Exception e)
            {
                e.printStackTrace();
            }
        }
    }