Java调用系统默认浏览器
import java.awt.Desktop;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
public class runBroswerC {
/**
* @author yyyit.com
* @param args
*/
public static void main(String[] args) {
runBroswer("www.yyyit.com");
}
public static void runBroswer(String webSite) {
try {
Desktop desktop = Desktop.getDesktop();
if (desktop.isDesktopSupported() && desktop.isSupported(Desktop.Action.BROWSE)) {
desktop.browse(new URI(webSite));
}
} catch (IOException ex) {
ex.printStackTrace();
} catch (URISyntaxException ex) {
ex.printStackTrace();
}
}
}