Monocle icon indicating copy to clipboard operation
Monocle copied to clipboard

monocle 21 jpms

Open tg-freigmbh opened this issue 11 months ago • 1 comments

I am using fx + monocle version 21.0.2 I put the libraries on the module path and use --add-modules=ALL-MODULE-PATH

I get an exception because monocle uses internal classes from javafx. Is this the expected behaviour and I should figure out the needed --add-exports myself? Its a bit odd that the documentation doesnt mention anything about this

Best regards, Thorsten Goetzke
{code} Caused by: java.lang.ExceptionInInitializerError: Exception java.lang.RuntimeException: java.lang.IllegalAccessError: superclass access check failed: class com.sun.glass.ui.monocle.MonoclePlatformFactory (in module org.testfx.monocle) cannot access class com.sun.glass.ui.PlatformFactory (in module javafx.graphics) because module javafx.graphics does not export com.sun.glass.ui to module org.testfx.monocle [in thread "main"]^M at [email protected]/com.sun.javafx.tk.quantum.QuantumToolkit.startup(QuantumToolkit.java:300)^M at [email protected]/com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:292)^M at [email protected]/com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:162)^M at [email protected]/javafx.embed.swing.JFXPanel.initFx(JFXPanel.java:247)^M at [email protected]/javafx.embed.swing.JFXPanel.(JFXPanel.java:263)^M at securiton.uls.utilities.lang.javafx.PlatformUtil.initJavaFx(PlatformUtil.java:38)^M at securiton.uls.tools.configuration.launcher.IntTestApplicationImpl.(IntTestApplicationImpl.java:157)^M ... 105 more^M {code}

tg-freigmbh avatar Mar 01 '24 14:03 tg-freigmbh

Yes, unfortunately TestFX and the Monocle builds for TestFX need access to some protected classes and those need to be opened from the command line. As you have also discovered, this is not well documented. However, since I'm also using TestFX 21 and Monocle 21, here are the commands you need to add:

--add-opens=javafx.base/com.sun.javafx.logging=ALL-UNNAMED 
--add-opens=javafx.graphics/com.sun.glass.ui=ALL-UNNAMED 
--add-opens=javafx.graphics/com.sun.javafx.application=ALL-UNNAMED 
--add-opens=javafx.graphics/com.sun.javafx.util=ALL-UNNAMED

mvsoder avatar Mar 01 '24 18:03 mvsoder