code: @IgnoreJRERequirement // UnixOperatingSystemMXBean
      private static void getOpenFileDescriptorCount(PrintWriter writer) throws UnsupportedEncodingException {
          try {
              OperatingSystemMXBean operatingSystemMXBean = ManagementFactory.getOperatingSystemMXBean();
              if (operatingSystemMXBean instanceof UnixOperatingSystemMXBean) {
                  UnixOperatingSystemMXBean unixOperatingSystemMXBean = (UnixOperatingSystemMXBean) operatingSystemMXBean;
                  writer.println("Open File Descriptor Count: " + unixOperatingSystemMXBean.getOpenFileDescriptorCount());
              } else {
                  writer.println("Wrong bean: " + operatingSystemMXBean);
              }
          } catch(LinkageError e) {
              writer.println("Unable to get the total number of open file descriptors using OperatingSystemMXBean");
          }
      }
docs: * Using OperatingSystemMXBean, we can obtain the total number of open file descriptors.