public static void browseURL (URL url, ResultListener<Void> listener, String genagent)
    {
        String[] cmd;
        if (RunAnywhere.isWindows()) {
            // TODO: test this on Vinders 98
//          cmd = new String[] { "rundll32", "url.dll,FileProtocolHandler",
//              url.toString() };
            String osName = System.getProperty("os.name");
            if (osName.indexOf("9") != -1 || osName.indexOf("Me") != -1) {
                cmd = new String[] { "command.com", "/c", "start",
                                     "\"" + url.toString() + "\"" };
            } else {
                cmd = new String[] { "cmd.exe", "/c", "start", "\"\"",
                                     "\"" + url.toString() + "\"" };
            }

        } else if (RunAnywhere.isMacOS()) {
            cmd = new String[] { "open", url.toString() };

        } else { // Linux, Solaris, etc
            cmd = new String[] { genagent, url.toString() };
        }

        // obscure any password information
        String logcmd = StringUtil.join(cmd, " ");
        logcmd = logcmd.replaceAll("password=[^&]*", "password=XXX");
        log.info("Browsing URL [cmd=" + logcmd + "].");

        try {
            Process process = Runtime.getRuntime().exec(cmd);
            BrowserTracker tracker = new BrowserTracker(process, url, listener);
            tracker.start();
        } catch (Exception e) {
            log.warning("Failed to launch browser [url=" + url +
                        ", error=" + e + "].");
            listener.requestFailed(e);
        }
    }
public static void browseURL ( URL url , ResultListener < Void > listener , String genagent ) { String [ ] cmd ; if ( RunAnywhere . isWindows ( ) ) { String osName = System . getProperty ( "os.name" ) ; if ( osName . indexOf ( "9" ) != - 1 || osName . indexOf ( "Me" ) != - 1 ) { cmd = new String [ ] { "command.com" , "/c" , "start" , "\"" + url . toString ( ) + "\"" } ; } else { cmd = new String [ ] { "cmd.exe" , "/c" , "start" , "\"\"" , "\"" + url . toString ( ) + "\"" } ; } } else if ( RunAnywhere . isMacOS ( ) ) { cmd = new String [ ] { "open" , url . toString ( ) } ; } else { cmd = new String [ ] { genagent , url . toString ( ) } ; } String logcmd = StringUtil . join ( cmd , " " ) ; logcmd = logcmd . replaceAll ( "password=[^&]*" , "password=XXX" ) ; log . info ( "Browsing URL [cmd=" + logcmd + "]." ) ; try { Process process = Runtime . getRuntime ( ) . exec ( cmd ) ; BrowserTracker tracker = new BrowserTracker ( process , url , listener ) ; tracker . start ( ) ; } catch ( Exception e ) { log . warning ( "Failed to launch browser [url=" + url + ", error=" + e + "]." ) ; listener . requestFailed ( e ) ; } }
Opens the user's web browser with the specified URL.

@param url the URL to display in an external browser.
@param listener a listener to be notified if we failed to launch the
browser. <em>Note:</em> it will not be notified of success.
@param genagent the path to the browser to execute on non-Windows,
non-MacOS.