public static void openUrlWithDefaultBrowser(String url) {
    String os = System.getProperty("os.name").toLowerCase();
    Runtime rt = Runtime.getRuntime();

    try {

      if (os.indexOf("win") >= 0) {

        // this doesn't support showing urls in the form of "page.html#nameLink"
        rt.exec("rundll32 url.dll,FileProtocolHandler " + url);

      } else if (os.indexOf("mac") >= 0) {

        rt.exec("open " + url);

      } else if (os.indexOf("nix") >= 0 || os.indexOf("nux") >= 0) {

        // Do a best guess on unix until we get a platform independent way
        // Build a list of browsers to try, in this order.
        String[] browsers = {
            "epiphany", "firefox", "mozilla", "konqueror", "netscape", "opera", "links", "lynx"
        };

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

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

      } else {
        return;
      }
    } catch (Exception e) {
      return;
    }
  }
Checks if the given key exists in the given JsonObject with a valid value.

@param jsonObject JsonObject
@param key        key
@param valueClass Class object for the value of the key.
@param isOptional A boolean specifying that the value may be optional. Note: This only works if the valueClass is String.

@return the value of the key
@throws KiteNoKeyException    if the key is not mapped in the JsonObject.
@throws KiteBadValueException if the value of the key is invalid.
KITE-Framework/src/main/java/org/webrtc/kite/Utils.java