TestFX / Monocle

Pre-packaged builds of Monocle (OpenJFX)
GNU General Public License v2.0
50 stars 24 forks source link

monocle 21 jpms #107

Open tg-freigmbh opened 8 months ago

tg-freigmbh commented 8 months ago

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 javafx.graphics@21.0.2/com.sun.javafx.tk.quantum.QuantumToolkit.startup(QuantumToolkit.java:300)^M at javafx.graphics@21.0.2/com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:292)^M at javafx.graphics@21.0.2/com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:162)^M at javafx.swing@21.0.2/javafx.embed.swing.JFXPanel.initFx(JFXPanel.java:247)^M at javafx.swing@21.0.2/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}

mvsoder commented 8 months ago

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