/*
 * [TestBrowserLaunch.java]
 *
 * Summary: Demonstrate how to launch a browser.
 *
 * Copyright: (c) 2010-2017 Roedy Green, Canadian Mind Products, http://mindprod.com
 *
 * Licence: This software may be copied and used freely for any purpose but military.
 *          http://mindprod.com/contact/nonmil.html
 *
 * Requires: JDK 1.8+
 *
 * Created with: JetBrains IntelliJ IDEA IDE http://www.jetbrains.com/idea/
 *
 * Version History:
 *  1.0 2010-03-27 initial version.
 */
package com.mindprod.example;

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

import static java.lang.System.*;

/**
 * Demonstrate how to launch a browser.
 *
 * @author Roedy Green, Canadian Mind Products
 * @version 1.0 2010-03-27 initial version.
 * @since 2010-03-27
 */
public final class TestBrowserLaunch
    {
    /**
     * // Launches the default browser to display a URL.
     *
     * @param args not used
     */
    public static void main( String[] args )
        {
        if ( Desktop.isDesktopSupported() )
            {
            final Desktop dt = Desktop.getDesktop();
            if ( dt.isSupported( Desktop.Action.BROWSE ) )
                {
                try
                    {
                    dt.browse( new URI( "http://www.mindprod.com/index.html" ) );
                    }
                catch ( URISyntaxException | IOException e )
                    {
                    err.println( e.getMessage() );
                    }
                }
            }
        }
    }