Runtime.getRuntime().exec("cmd /c start http://www.sina.com.cn");

解决方案 »

  1.   

    Runtime.getRuntime().exec("cmd /c start c:\test.html " ); \\只在windows下有效,linux下不行的!
      

  2.   

    import java.net.*;
    import java.io.*;public class Gethtml {
        public static void main(String[] args) {
            try{
                URL u = new URL("http://www.sina.com.cn");
                InputStream in = u.openStream();
                Reader r = new InputStreamReader(new BufferedInputStream(in));
                int c;
                while((c = r.read()) != -1){
                System.out.print((char)c);//或者System.out.write(c);
                }
            }
            catch(MalformedURLException e){
                e.printStackTrace();}
            catch(IOException ignored){
                ignored.printStackTrace();
                }
        }
    }
      

  3.   

    .
        .
    Runtime r = Runtime.getRuntime();
    Process p = r.exec("cmd.exe /c start http://www.sohu.com");
    p.waitFor();
       .
       .