I run my JavaFX app with VM options:
--module-path "C:\Software\javafx-sdk-18.0.1\lib" --add-modules javafx.base,javafx.controls,javafx.fxml,javafx.graphics
yet when I try to run the app, I get:
Caused by: java.lang.IllegalAccessError: class MyWindow (in unnamed module @0xb083ee4) cannot access class com.sun.javafx.tk.Toolkit (in module javafx.graphics) because module javafx.graphics does not export com.sun.javafx.tk to unnamed module @0xb083ee4
(As a small note, I rely on FontMetrics
, if this makes difference.)
I am wondering what's going on and how to fix it?