question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

macOS System Menu Bar Support

See original GitHub issue

Trying 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:closed
  • Created 3 years ago
  • Comments:9 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
kevinrushforthcommented, Oct 12, 2020

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.

0reactions
abhinayagarwalcommented, Oct 16, 2020

Closing as this is a JavaFX issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

What's in the menu bar on Mac? - Apple Support
The menu bar runs along the top of the screen on your Mac. Use the menus and icons in the menu bar to...
Read more >
How to Customize Your Mac's Menu Bar • Gear Patrol
The Menu Bar is the thing that runs along the top of your Mac's screen where all the menus — Apple, File, Edit,...
Read more >
A Beginner's Guide to the macOS Menu Bar - MakeUseOf
You can access the menu bar at any time using a keyboard shortcut. Use Ctrl + F2 to focus on the menu bar....
Read more >
Where is the Menu Bar on Mac | Proven Solution [2022]
The first element on the menu bar is the "Apple menu." This function is situated at the left corner of the menu bar...
Read more >
How to use the Menu bar on your Mac - iMore
Luckily, the Mac has a Menu bar (the small strip at the top of your screen) which has some very useful shortcuts to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found