Java tutorial
//package com.java2s; /* * Copyright (c) 2013, Bui Nguyen Thang, thang.buinguyen@gmail.com, thangbui.net. All rights reserved. * Licensed under the GNU General Public License version 2.0 (GPLv2) * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html */ import java.awt.*; import java.io.IOException; import java.net.URI; import java.net.URISyntaxException; public class Main { private static void openWebpage(URI uri) throws IOException { Desktop desktop = Desktop.isDesktopSupported() ? Desktop.getDesktop() : null; if (desktop != null && desktop.isSupported(Desktop.Action.BROWSE)) { desktop.browse(uri); } } public static void openWebpage(String url) throws IOException, URISyntaxException { openWebpage(new URI(url)); } }