net.i2p.apps.systray

## Class UrlLauncher

- java.lang.Object
- - net.i2p.apps.systray.UrlLauncher

    public class UrlLauncher
    extends Object

A quick and simple multi-platform URL launcher. It attempts to launch the default browser for the host platform first, then popular third-party browsers if that was not successful.

Handles Galeon, Internet Explorer, Konqueror, Links, Lynx, Mozilla, Mozilla Firefox, Netscape, Opera, and Safari.

Author:
  hypercubus

### Field Summary

Fields
`(package private) ShellCommand` `_shellCommand`

### Constructor Summary

Constructors
Constructor and Description
`UrlLauncher()`

### Method Summary

Methods
`static void` `main(String[] args)`
`boolean` `openUrl(String url)` Discovers the operating system the installer is running under and tries to launch the given URL using the default browser for that platform; if unsuccessful, an attempt is made to launch the URL using the most common browsers.
`boolean` `openUrl(String url, String browser)` Opens the given URL with the given browser.
`boolean` `waitForServer(String urlString)` Prevent bad user experience by waiting for the server to be there before launching the browser.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### _shellCommand

    ShellCommand _shellCommand

### Constructor Detail

#### UrlLauncher

    public UrlLauncher()

### Method Detail

#### waitForServer

    public boolean waitForServer(String urlString)

Prevent bad user experience by waiting for the server to be there before launching the browser.

Returns:
  success

#### openUrl

    public boolean openUrl(String url)
                    throws Exception

Discovers the operating system the installer is running under and tries to launch the given URL using the default browser for that platform; if unsuccessful, an attempt is made to launch the URL using the most common browsers.

Parameters:
  `url` - The URL to open.
Returns:
  `true` if the operation was successful, otherwise `false`.
Throws:
  `Exception`

#### openUrl

    public boolean openUrl(String url,
                  String browser)
                    throws Exception

Opens the given URL with the given browser.

Parameters:
  `url` - The URL to open.
  `browser` - The browser to use.
Returns:
  `true` if the operation was successful, otherwise `false`.
Throws:
  `Exception`

#### main

    public static void main(String[] args)