macOS System Menu Bar Support
See original GitHub issueTrying to add support for NSMenuFX in a Hello World JavaFX Maven project.
Lots of errors related to modules / access. Here is the trail for the issue on the NSMenuFX page:
https://github.com/codecentric/NSMenuFX/issues/29
That issue should have enough for repro steps, but the short version:
- Create a HelloWorld JavaFX Maven project
- Add the NSMenuFX dependency and simple test case
This is both a really nice module (for native macOS menu integration) and also a nice test case for working with/around the Java module system.
Here is sample of the error output. Let me know if you need any additional information.
[INFO] --- javafx-maven-plugin:0.0.4:run (default-cli) @ hellofx --- Exception in Application start method java.lang.reflect.InvocationTargetException at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:564) at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:464) at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:363) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:564) at java.base/sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:1071) Caused by: java.lang.RuntimeException: Exception in Application start method at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:900) at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(LauncherImpl.java:195) at java.base/java.lang.Thread.run(Thread.java:832) Caused by: java.lang.IllegalAccessError: class de.codecentric.centerdevice.glass.AdapterContext (in unnamed module @0x797d0761) cannot access class com.sun.javafx.tk.Toolkit (in module javafx.graphics) because module javafx.graphics does not export com.sun.javafx.tk to unnamed module @0x797d0761 at de.codecentric.centerdevice.glass.AdapterContext.createContext(AdapterContext.java:34) at de.codecentric.centerdevice.glass.AdapterContext.getContext(AdapterContext.java:19) at de.codecentric.centerdevice.MenuToolkit.toolkit(MenuToolkit.java:57) at de.codecentric.centerdevice.MenuToolkit.toolkit(MenuToolkit.java:53) at de.codecentric.centerdevice.MenuToolkit.toolkit(MenuToolkit.java:49) at sample.Main.start(Main.java:52) at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$9(LauncherImpl.java:846) at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runAndWait$12(PlatformImpl.java:455) at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:428) at java.base/java.security.AccessController.doPrivileged(AccessController.java:391) at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:427) at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96) Exception running application sample.Main
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (2 by maintainers)
Top GitHub Comments
I had hoped to get it in for openjfx15, but it missed that. It’s on the list of fixes planned for openjfx16, but isn’t done yet.
Closing as this is a JavaFX issue.