static void loadLibrary() {
    try {
      loadLibraryImpl();
    }
    catch (Throwable e) {
      LOG.error("Failed to load nst library for touchbar: ", e);
    }

    if (nstLibrary != null) {
      // small check that loaded library works
      try {
        final ID test = nstLibrary.createTouchBar("test", (uid) -> ID.NIL, null);
        if (test == null || test.equals(ID.NIL)) {
          LOG.error("Failed to create native touchbar object, result is null");
          nstLibrary = null;
        }
        else {
          nstLibrary.releaseNativePeer(test);
          LOG.info("nst library works properly, successfully created and released native touchbar object");
        }
      }
      catch (Throwable e) {
        LOG.error("nst library was loaded, but can't be used: ", e);
        nstLibrary = null;
      }
    }
    else {
      LOG.error("nst library wasn't loaded");
    }
  }
static void loadLibrary()