java后台打开浏览器代码

import java.awt.Desktop;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;

public class aa{
    public static void main(String[] args) throws IOException, URISyntaxException {  
        String webSite = "http://www.baidu.com";
        OpenBroswer(webSite);
    }  
      
    public static void OpenBroswer(String webSite) throws URISyntaxException,  
            IOException {
        Desktop desktop = Desktop.getDesktop();  
        if (Desktop.isDesktopSupported() && desktop.isSupported(Desktop.Action.BROWSE)) {  
            URI uri = new URI(webSite);  
            desktop.browse(uri);  
        }  
    }  
}

  

原文地址:https://www.cnblogs.com/haopengchen/p/8383731.html