In a non-modular app that uses ControlsFX's GridView (ControlsFX version = '11.1.1', JDK 17), if I run it in an Eclipse launch configuration with the VM arguments settings (in the (x)=Arguments tab) with the same --add-opens
and --add-export
arguments as shown in the code snippet below, the app runs just fine.
However, when I invoke gradle run
from the Gradle Tasks view in Eclipse, with the following run
block, the result is
java.lang.IllegalAccessError:
class org.controlsfx.control.spreadsheet.GridBase (in unnamed module @0x73a0cead)
cannot access class com.sun.javafx.event.EventHandlerManager (in module javafx.base)
because module javafx.base does not export com.sun.javafx.event to unnamed module @0x73a0cead
Here's the run
block in build.gradle
for the project.
run {
jvmArgs
'--add-opens=javafx.controls/javafx.scene.control.skin=org.controlsfx.controls \
--add-opens=javafx.controls/javafx.scene.control.skin=ALL-UNNAMED \
--add-exports=javafx.base/com.sun.javafx.event=org.controlsfx.controls \
--add-exports=javafx.base/com.sun.javafx.event=ALL-UNNAMED \
--add-exports=javafx.graphics/com.sun.javafx.scene=org.controlsfx.controls, \
--add-exports=javafx.graphics/com.sun.javafx.scene.traversal=org.controlsfx.controls \
--add-exports=javafx.graphics/com.sun.javafx.css=org.controlsfx.controls \
--add-exports=javafx.graphics/com.sun.javafx.scene=org.controlsfx.controls \
--add-exports=javafx.controls/com.sun.javafx.scene.control.behavior=org.controlsfx.controls'
}
the app runs, but the FXML views that include a GridView are empty windows (as expected given the above error).
You can clearly see that the export of javafx.base/com.sun.javafx.event
is specified in the run
block. Yet the behavior of gradle run
is different (failure) from that of the launch configuration (success).
Any thoughts on what is causing the failure would be greatly appreciated.