protected void execute() throws IOException {
        if (url.startsWith("#"))
            try {
                connection.send("JOIN " + url);
            } catch (IOException | BadLocationException ex) {
                Logger.getLogger(URLLinkAction.class.getName()).log(Level.SEVERE, null, ex);
            }
        else {
            String osName = System.getProperty("os.name").toLowerCase();
            Runtime rt = Runtime.getRuntime();
            if (osName.contains("win")) rt.exec("rundll32 url.dll,FileProtocolHandler " + url);
            else if (osName.contains("mac")) rt.exec("open " + url);
            else if (osName.contains("ix") || osName.contains("ux") || osName.contains("sun")) {
                String[] browsers = {"epiphany", "firefox", "mozilla", "konqueror", "netscape", "opera", "links", "lynx"};

                // Build a command string which looks like "browser1 "url" || browser2 "url" ||..."
                StringBuilder cmd = new StringBuilder();
                for (int i = 0; i < browsers.length; i++)
                    cmd.append(i == 0 ? "" : " || ").append(browsers[i]).append(" \"").append(url).append("\" ");

                rt.exec(new String[]{"sh", "-c", cmd.toString()});
            }
        }
    }