boolean () { if (IS_ENABLED != null) { return IS_ENABLED; } IS_ENABLED = false; if (!SystemInfoRt.isJBSystemMenu) { return false; } if (Boolean.getBoolean("apple.laf.useScreenMenuBar")) { getLogger().info("apple.laf.useScreenMenuBar==true, default screen menu implementation will be used"); return false; } @SuppressWarnings("SpellCheckingInspection") Path lib = PathManager.findBinFile("libmacscreenmenu64.dylib"); try { System.load(Objects.requireNonNull(lib).toString()); nativeInitClass(); // create and dispose a native object (just for to test) Menu test = new Menu("test"); test.ensureNativePeer(); Disposer.dispose(test); } catch (Throwable e) { // default screen menu implementation will be used getLogger().warn("can't load menu library: " + lib + ", exception: " + e.getMessage()); return false; } IS_ENABLED = true; getLogger().info("use new ScreenMenuBar implementation"); return true; }