diff --git a/src/main/java/com/cburch/logisim/gui/start/Startup.java b/src/main/java/com/cburch/logisim/gui/start/Startup.java index 08f8b272a..203522a77 100644 --- a/src/main/java/com/cburch/logisim/gui/start/Startup.java +++ b/src/main/java/com/cburch/logisim/gui/start/Startup.java @@ -360,8 +360,13 @@ public static Startup parseArgs(String[] args) { shallClearPreferences = cmd.hasOption(ARG_CLEAR_PREFS_LONG); } if (!isTty) { - // we're using the GUI: Set up the Look&Feel to match the platform - System.setProperty("apple.laf.useScreenMenuBar", "true"); + // Check if using Sonoma and Homebrew OpenJDK + // Currently, Homebrew OpenJDK on Sonoma crashes on launch + // https://github.com/Homebrew/homebrew-core/issues/150824 + if (MacCompatibility.isSwingUsingScreenMenuBar()) { + // we're using the GUI: Set up the Look&Feel to match the platform + System.setProperty("apple.laf.useScreenMenuBar", "true"); + } // Initialize graphics acceleration if appropriate AppPreferences.handleGraphicsAcceleration(); } @@ -1068,5 +1073,4 @@ public void eventDispatched(AWTEvent event) { } } } - } // Startup diff --git a/src/main/java/com/cburch/logisim/util/MacCompatibility.java b/src/main/java/com/cburch/logisim/util/MacCompatibility.java index c7a0a1262..da2c20438 100644 --- a/src/main/java/com/cburch/logisim/util/MacCompatibility.java +++ b/src/main/java/com/cburch/logisim/util/MacCompatibility.java @@ -16,7 +16,14 @@ public final class MacCompatibility { private static final boolean runningOnMac = System.getProperty("os.name").toLowerCase().contains("mac"); - private static boolean usingScreenMenuBar = runningOnMac; + + private static final boolean runningOnMacAndSonomaHomebrewOpenJDK = + runningOnMac + && System.getProperty("os.version").startsWith("14") + && System.getProperty("java.vendor").toLowerCase().startsWith("homebrew") + && System.getProperty("java.runtime.name").toLowerCase().startsWith("openjdk"); + + private static boolean usingScreenMenuBar = runningOnMac && !runningOnMacAndSonomaHomebrewOpenJDK; private MacCompatibility() { throw new IllegalStateException("Utility class. No instantiation allowed."); @@ -45,7 +52,7 @@ public static boolean isSwingUsingScreenMenuBar() { public static void setFramelessJMenuBar(JMenuBar menubar) { try { // DHH This method allows the app to run without a frame on the Mac. The menu will still show. - if (runningOnMac) { + if (runningOnMac && !runningOnMacAndSonomaHomebrewOpenJDK) { Desktop.getDesktop().setDefaultMenuBar(menubar); } } catch (Exception t) {