cmd = "rundll32 url.dll,FileProtocolHandler http://www.csdn.net"
Process p = Runtime.getRuntime().exec(cmd);

解决方案 »

  1.   

    to chenweionline() 
    可否解释一下这条命令的参数的含义?
      

  2.   

    applet的showDocument()很方便,不知道符合不符合你的要求
      

  3.   

    cmd = "rundll32 url.dll,FileProtocolHandler http://www.csdn.net"
    这条命令很好,但我不知道这些参数的意思。
      

  4.   


    import java.awt.*;
    import java.awt.event.*;
    import java.applet.*;
    import java.net.*;
    //JAVA程序对网上资源的访问示例(要求网络连接可用,在浏览器中运行)
    public class AppletTest extends Applet implements ActionListener{
    Label lab=new Label("请输入一个网址:");
            TextField text=new TextField(30);
            Button b1=new Button("GO");
            URL url;
    public void init(){
    this.add(lab);
    this.add(text);
    this.add(b1);
    b1.addActionListener(this);
    }
    public void actionPerformed(ActionEvent e){
    if(e.getActionCommand()=="GO"){
                     try{
    url=new URL(text.getText().trim());//获取用户在文档框中输入的URL
    getAppletContext().showDocument(url);//链接到指定网页
    }
    catch(Exception g){System.out.println(g.toString());}
    }
    }//actionPerformed
    }//AppletTest