Swing调用浏览器

 //调用默认浏览器

//String cmmd ="rundll32 url.dll FileProtocolHandler "; 


// 调用IE
String cmmd = "C:/Program Files/Internet Explorer/iexplore.exe "; 

String url=tf.getText();


if("".equals(url))url="http://www.csdn.net";
Runtime rt=Runtime.getRuntime();


try {
rt.exec(cmmd + url);
} catch (IOException e) {
e.printStackTrace();
}

你可能感兴趣的:(Swing)