open Browser - Java Native OS

Java examples for Native OS:Browser

Description

open Browser

Demo Code


//package com.java2s;
import java.awt.*;
import java.net.URI;

public class Main {
    public static void openBrowser(URI url) throws Exception {
        if (Desktop.isDesktopSupported()) {
            Desktop.getDesktop().browse(url);
        } else {//from  ww w . j  a v  a  2  s. c  om
            System.out
                    .println("Can not open browser because this capability is not supported on your platform.");
        }

    }
}

Related Tutorials