怎么设置tomcat在启动完tomcat后,自动打开浏览器并找到某地址如www.baidu.com

解决方案 »

  1.   

    可以写一个Filter在init这个方法中写一个线程,用API调用浏览器的可执行程序。这个API我还真不知道,自已查查就知道了,大概是execute("c:\\windows\\iexplorer\\iexplorer.exe http://www.baidu.com");
      

  2.   

    有何用??tomchat还能兼职做DNS域名服务器?
      

  3.   


    我的意思是正确启动tomcat后,我们什么也不做,自动打开浏览器。(我们只点启动tomcat)
      

  4.   


    多谢大家,搞定了。按照zsz0147的方法
    写了个filter,在filter的InitFilter()方法中实现: String cmd = "C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe localhost:8080";
         Runtime run = Runtime.getRuntime();   
         try {
       run.exec(cmd);
    } catch (IOException e) {
       e.printStackTrace();
    }