sshahine / JFoenix

JavaFX Material Design Library
MIT License
6.29k stars 1.06k forks source link

InaccessibleObjectException for JFXHighlighter #1189

Closed MujtabaMohsin closed 3 years ago

MujtabaMohsin commented 3 years ago

Hello I'm trying to use JFXHighlighter class in the JFoenix library but it's not working as you can see the error: JFXHighlighter highlighter = new JFXHighlighter(); //runtime error

java.lang.reflect.InaccessibleObjectException: Unable to make private com.sun.javafx.scene.text.TextLayout javafx.scene.text.Text.getTextLayout() 
accessible: module javafx.graphics does not "opens javafx.scene.text" to module com.jfoenix

I added the jar file to the project and all other classes and controls work well. (I don't use Maven)

I search in the GitHub issues and I found one similar to this, the solution was to add the proper exports to VM options as these:

--add-exports javafx.graphics/com.sun.javafx.geom=ALL-UNNAMED 
--add-exports javafx.graphics/com.sun.javafx.scene.text=ALL-UNNAMED 
--add-opens javafx.graphics/javafx.scene=ALL-UNNAMED 
--add-opens javafx.graphics/javafx.scene.text=ALL-UNNAMED

and the following module file: requires javafx.base; requires javafx.controls; requires javafx.graphics; requires com.jfoenix; requires javafx.fxml;

I added them all but the same result. I use Java 11 ans Eclipse IDE

FelipeAumannRS commented 3 years ago

are you using a modular project (using a module-info.java file), and/or gradle based project?

DevSerendipity commented 3 years ago

yes I am using maven with module and I got the same problem

sshahine commented 3 years ago

Hello, Well you are missing some opens and exports, you can check my other repo JFXBase for the required exports.

Regards,