Open Javafx module to Gson module in Intellij

Viewed 143

Im trying to save a gamestate object as a Gson file in java, but i get the error Unable to make field private final float javafx.scene.paint.Color.red accessible: module javafx.graphics does not "opens javafx.scene.paint" to module com.google.gson

How do I open the module to Gson?

1 Answers

I believe you have to explicitly open the module when you run the program on the command line with the —add-opensflag.

Eg add the following to the command line options:

—add-opens javafx.graphics=com.google.gson
Related