Closed Reyzerbit closed 6 years ago
This is because NSMenuFX currently uses some restricted API to get at the data it needs. In such a case you get this warning from Java 9. For the moment you can just ignore it but in the long run these dependencies should be removed, if possible.
@mipastgt yes, I know. I tried your rework as well, but what I'm saying is it's a bug that needs to be repaired.
True, but it is not so easy. There are basically two different options to fix that: 1) Find an alternative java 9 api that allows for changing the menu bar 2) Create an own native method to update the menu bar
Unfortunately i couldn't find any official API yet, which basically leaves us with a new native adapter. I think this would be a good thing anyway as it would be completely independent of whatever oracle comes up for the menu bar in the future and more importantly, it would give us access to all host specific features supported by macOS, like a windowless menu bar or dock icon menus. The downside of this however is, it is a bit of work and unfortunately I currently can't find enough time to get it done. I already started a branch here https://github.com/codecentric/NSMenuFX/tree/own-native-adapter which already has most fundamentals working.
Hi there! Looking at the OP, it seems it's not only the issue with illegal access, but the NoSuchMethodError that can be seen at the end of the log and which I'm also hitting when I try to run my application on java9.
I've seen there was a change to make it compatible with java9 committed on July, 2017, but the last release is 2.1.5 in March 2017. In fact I've compiled from sources and my problem is fixed.
Is there any problem into making a new release? This way I could just use it instead of having to fork or provide an artifact by myself to fulfill my dependencies.
Thanks a lot, and congrats for this library. My java applications no longer look like aliens on OSX. ;-)
Best regards
Hi, thanks for the reminder! Actually I wasn't aware that this has not been released yet. I'm just deploying an update (2.1.6) to maven central!
Hmm, weird, i got an error during deployment but sonatype lists the artefact as released... So I think it should be available... If not, please let me know
Great, then I can finally drop using my private build too :-)
If you also want to get rid of the warnings about illegal reflective access, you can add the following run-time arguments to your java call.
--add-opens=javafx.graphics/com.sun.javafx.tk.quantum=ALL-UNNAMED
--add-opens=javafx.graphics/com.sun.glass.ui.mac=ALL-UNNAMED
Worked like a charm. Thanks a lot!
Best regards.
Alright, so I love your library, and I am using for a senior project. However, upong upgrading my project to 1.9 (to get access to the Desktop class), I now receive this error:
WARNING: An illegal reflective access operation has occurred WARNING: Illegal reflective access by de.codecentric.centerdevice.util.ReflectionUtils (file:/Users/diegobatista/Git%20Repositories/SURPG/Java%20Libraries/NSMenuFX.jar) to field com.sun.javafx.tk.quantum.GlassSystemMenu.glassSystemMenuBar WARNING: Please consider reporting this to the maintainers of de.codecentric.centerdevice.util.ReflectionUtils WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations WARNING: All illegal access operations will be denied in a future release Exception in thread "JavaFX Application Thread" java.lang.NoSuchMethodError: com.sun.javafx.stage.StageHelper.getStages()Ljavafx/collections/ObservableList;
I don't know if this has to do with the change of JavaFX with Java 9, but this didn't happen before. Please help! Thanks.