public static void openLink(URI link) {
    try {
      Class desktopClass = Class.forName("java.awt.Desktop");
      Object o = desktopClass.getMethod("getDesktop", new Class[0]).invoke(null, new Object[0]);
      desktopClass.getMethod("browse", new Class[] { URI.class }).invoke(o, new Object[] { link });
    } catch (Throwable e) {
      e.printStackTrace();
    }
  }