java打开网页URI

 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();

}
        
}
}

猜你喜欢

转载自blog.csdn.net/ruoxuan25/article/details/76228710
今日推荐