java打开浏览器新窗口并跳转到指定网站

win10系统,谷歌浏览器下,亲测有效。
(作用1:开发模式下,运行直接跑swagger地址)

在方法体里,加入如下代码:

            try {
    
    
                Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler http://www.baidu.com/");
            } catch (IOException e) {
    
    
                // nothing
            }
            ```

猜你喜欢

转载自blog.csdn.net/weixin_43329956/article/details/121281234