admin管理员组文章数量:1026989
package com.test;
import java.awt.Desktop;
import java.io.IOException;
import java.URI;
import java.URISyntaxException;
public class TestHtml {
public static void main(String[] args) {
String str = "cmd /c start iexplore http://www.baidu";
try {
Runtime.getRuntime().exec(str);
} catch (IOException e) {
e.printStackTrace();
}
try {
URI uri = new URI("http://www.baidu");
Desktop.getDesktop().browse(uri);
} catch (URISyntaxException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
}
package com.test;
import java.awt.Desktop;
import java.io.IOException;
import java.URI;
import java.URISyntaxException;
public class TestHtml {
public static void main(String[] args) {
String str = "cmd /c start iexplore http://www.baidu";
try {
Runtime.getRuntime().exec(str);
} catch (IOException e) {
e.printStackTrace();
}
try {
URI uri = new URI("http://www.baidu");
Desktop.getDesktop().browse(uri);
} catch (URISyntaxException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
}
版权声明:本文标题:java 《七》打开默认浏览器并且打开指定网页 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/jiaocheng/1726856184a674462.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论