Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JARs built will not run with Homebrew OpenJDK on macOS Sonoma #1

Closed
rarecoil opened this issue Oct 18, 2023 · 2 comments
Closed

JARs built will not run with Homebrew OpenJDK on macOS Sonoma #1

rarecoil opened this issue Oct 18, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@rarecoil
Copy link
Owner

rarecoil commented Oct 18, 2023

JARs built with mvn verify in the traditional way do not execute when using Homebrew OpenJDK. An attempt to load CMenuItem will crash the application.

This is a known issue in other applications such as visualvm - oracle/visualvm#528 and that group believes it's a Homebrew JDK problem.

From the stack trace:

Crashed Thread:        0  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_BREAKPOINT (SIGTRAP)
Exception Codes:       0x0000000000000001, 0x000000018790161c

Termination Reason:    Namespace SIGNAL, Code 5 Trace/BPT trap: 5
Terminating Process:   exc handler [36848]

Application Specific Information:
References to Carbon menus are disallowed with AppKit menu system (see rdar://101002625). Use instances of NSMenu and NSMenuItem directly instead.

Love it when Apple links to internal bugs.

@rarecoil rarecoil added the bug Something isn't working label Oct 18, 2023
@jourquin
Copy link

jourquin commented Nov 2, 2023

The problem seems to appear for any java app that uses the native macOS "Screen menu bars" setting

System.setProperty("apple.laf.useScreenMenuBar", "true");

This affects macOS Sonoma systems with a Homebrew OpenJDK.

A quick and dirty fix (in the java code) is to avoid setting this property on affected systems. A example can be found at the end of the following code :
https://github.com/jourquin/Nodus/blob/master/src/edu/uclouvain/core/nodus/Nodus.java

The test is used in line 253.

Obviously, the menu bar will be in the main application window, and not on the top of the screen, which is not a standard behavior for macOS applications.

@rarecoil
Copy link
Owner Author

rarecoil commented Nov 4, 2023

@jourquin Thanks for providing a workaround for now; I've patched this code and am closing the issue. This tool is from 2010 and I'm just trying to preserve it for future use, so whether or not it uses the macOS system menubar is irrelevant for keeping it functional.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants