java打开网页URI

来源:互联网 发布:软件开发人员薪酬 编辑:程序博客网 时间:2024/05/17 11:35
package web;


/**
 * 打开网页URI
 * @author HZBOX
 *
 */
public class Demo {
public static void main(String[] args) {
String[] uris = new String[]{
"https://zhidao.baidu.com/question/937730512301433012.html",
"https://news.cnblogs.com/n/page/2/",
"https://search.jd.com/Search?keyword=%E9%AD%94%E4%B9%90%E7%A7%91%E6%8A%80%20oracle&enc=utf-8&wq=%E9%AD%94%E4%B9%90%E7%A7%91%E6%8A%80%20oracle&pvid=f9d99d9d1e8d4edc86f139b0faaa49cb",
"https://news.cnblogs.com/n/page/2/"
};

java.net.URI uri;
try {
for(String str : uris){
uri = new java.net.URI(str);
java.awt.Desktop.getDesktop().browse(uri);
}
} catch (Exception e) {
e.printStackTrace();

}
        
}
}
原创粉丝点击