方式1:启用系统默认浏览器来打开网址。
URI uri=java.net.URI.create(loginUrl);
Desktop dp=java.awt.Desktop.getDesktop();
if(dp.isSupported(java.awt.Desktop.Action.BROWSE)){//获取系统默认浏览器打开链接
dp.browse(uri);
}
方式2:
Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler http://www.baidu.com");
方式三:启用cmd运行IE的方式来打开网址。
String str = "cmd /c start iexplore http://blog.youkuaiyun.com/powmxypow";
try {
Runtime.getRuntime().exec(str);
} catch (IOException e) {
e.printStackTrace();
}