0

I am developing an application with JavaFX but I have an error when I try to load an fxml interface containing a JFXDatePicker. The other interfaces load without problem

Here is the error message:

Caused by: java.lang.IllegalAccessError: superclass access check failed: class com.jfoenix.controls.behavior.JFXGenericPickerBehavior (in unnamed module @0x534cfe42) cannot access class com.sun.javafx.scene.control.behavior.ComboBoxBaseBehavior (in module javafx.controls) because module javafx.controls does not export com.sun.javafx.scene.control.behavior to unnamed module @0x534cfe42

I use JDK 11 With jfoenix 9.0.9

I tried to change my jdk version but without success

  • I use the builder of my IDE. My IDE is Eclipse 2020. No i didn't write a module-info.java – Cedric Gilles Mar 16 '21 at 07:59
  • The error message you posted indicates that there is a problem regarding the accessibility of [java modules](https://www.oracle.com/corporate/features/understanding-java-9-modules.html). – Abra Mar 16 '21 at 08:04
  • Since my project is not a modular application what could cause this problem then? – Cedric Gilles Mar 16 '21 at 08:14
  • Since Java 9 ___all___ java applications ___are___ modular. Why do you claim that yours is not? – Abra Mar 16 '21 at 08:21
  • Oh right, I thought that since I didn't put a module-info.java my application wasn't modular – Cedric Gilles Mar 16 '21 at 08:35

2 Answers2

1

Run -> Edit Configuration -> Modify option -> Add VM option ->

--add-exports=javafx.controls/com.sun.javafx.scene.control.behavior=ALL-UNNAMED
--add-exports=javafx.base/com.sun.javafx.binding=ALL-UNNAMED
--add-exports=javafx.graphics/com.sun.javafx.stage=ALL-UNNAMED
--add-exports=javafx.base/com.sun.javafx.event=ALL-UNNAMED
Zois Tasoulas
  • 1,242
  • 1
  • 11
  • 23
0

For anyone else using SceneBuilder, I added this to app/build.gradle file:

    doFirst {
        jvmArgs += ['--add-opens=javafx.fxml/javafx.fxml=ALL-UNNAMED' ]
        jvmArgs += ['--add-exports=javafx.controls/com.sun.javafx.scene.control.behavior=ALL-UNNAMED' ] 
        jvmArgs += ['--add-exports=javafx.graphics/com.sun.javafx.stage=ALL-UNNAMED' ] 
        jvmArgs += ['--add-exports=javafx.base/com.sun.javafx.binding=ALL-UNNAMED' ]
        jvmArgs += ['--add-exports=javafx.base/com.sun.javafx.event=ALL-UNNAMED' ] 
        jvmArgs += ['--add-exports=javafx.graphics/com.sun.javafx.scene=ALL-UNNAMED' ]
        if (javafx.platform.classifier == 'linux') jvmArgs += '-Djdk.gtk.version=2'
    }