1

I am trying to use com.jfoenix.controls.JFXChipView along with JavaFX in Java 11. This is my maven dependency:

    <dependency>
        <groupId>com.jfoenix</groupId>
        <artifactId>jfoenix</artifactId>
        <version>9.0.9</version>
    </dependency>

I am also using com.jfoenix.controls.JFXCheckBox in another module which works well, but when I am trying to open a module which includes the ChipView, I get the following error:

Exception in thread "JavaFX Application Thread" java.lang.IllegalAccessError: class com.jfoenix.controls.JFXAutoCompletePopup (in module com.jfoenix) cannot access class com.sun.javafx.stage.PopupWindowHelper (in module javafx.graphics) because module javafx.graphics does not export com.sun.javafx.stage to module com.jfoenix
at com.jfoenix/com.jfoenix.controls.JFXAutoCompletePopup.<init>(JFXAutoCompletePopup.java:68)
at com.jfoenix/com.jfoenix.skins.JFXChipViewSkin$ChipsAutoComplete.<init>(JFXChipViewSkin.java:386)
at com.jfoenix/com.jfoenix.controls.JFXChipView.<init>(JFXChipView.java:167)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
at java.base/java.lang.Class.newInstance(Class.java:584)
at javafx.fxml/javafx.fxml.FXMLLoader$InstanceDeclarationElement.constructValue(FXMLLoader.java:1019)
at javafx.fxml/javafx.fxml.FXMLLoader$ValueElement.processStartElement(FXMLLoader.java:754)
at javafx.fxml/javafx.fxml.FXMLLoader.processStartElement(FXMLLoader.java:2722)
at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2552)
at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2466)
at javafx.fxml/javafx.fxml.FXMLLoader.load(FXMLLoader.java:2435)
at gui/de.company.project.gui.department.edit.DepartmentEditGUI.<init>(DepartmentEditGUI.java:28)
at gui/de.company.project.gui.department.DepartmentGUIController.openEdit(DepartmentGUIController.java:175)
at gui/de.company.project.gui.department.DepartmentGUIController.lambda$initButtonListeners$5(DepartmentGUIController.java:98)
at javafx.base/com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86)
at javafx.base/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
at javafx.base/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
at javafx.base/com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at javafx.base/com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
at javafx.base/com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:54)
at javafx.base/javafx.event.Event.fireEvent(Event.java:198)
at javafx.graphics/javafx.scene.Scene$MouseHandler.process(Scene.java:3851)
at javafx.graphics/javafx.scene.Scene$MouseHandler.access$1200(Scene.java:3579)
at javafx.graphics/javafx.scene.Scene.processMouseEvent(Scene.java:1849)
at javafx.graphics/javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2588)
at javafx.graphics/com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:397)
at javafx.graphics/com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:295)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at javafx.graphics/com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleMouseEvent$2(GlassViewEventHandler.java:434)
at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:390)
at javafx.graphics/com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:433)
at javafx.graphics/com.sun.glass.ui.View.handleMouseEvent(View.java:556)
at javafx.graphics/com.sun.glass.ui.View.notifyMouse(View.java:942)
at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:174)
at java.base/java.lang.Thread.run(Thread.java:834)

My module-info.java looks like this:

open module gui {
    requires javafx.controls;
    requires javafx.graphics;
    requires javafx.fxml;
    requires javafx.base;

    requires com.jfoenix;
    requires static lombok;
    requires spring.context;
    requires java.desktop;
    requires core_entity;
    requires util;
    requires spring.boot.autoconfigure;
    requires spring.boot;
    requires controlsfx;

    requires com.fasterxml.classmate;
}
kaiffeetasse
  • 481
  • 1
  • 8
  • 18
  • Not certain, but I think you need `requires transitive javafx.graphics ; ` (and possibly other modules that jfoenix needs to access). – James_D May 06 '20 at 15:01
  • @James_D unfortunatley this doesn't resolves my error – kaiffeetasse May 06 '20 at 15:04
  • you can focus on "*because module `javafx.graphics` does not export `com.sun.javafx.stage` to module `com.jfoenix`*" – Naman May 06 '20 at 17:02
  • @Naman I did, I exported my module to com.jfoenix and tried different other exports but nothing worked... – kaiffeetasse May 06 '20 at 17:10
  • Okay. Adding the VM arg `--add-exports javafx.graphics/com.sun.javafx.stage=com.jfoenix` should ideally get you away from this. – Naman May 06 '20 at 18:09
  • Yes, `--add-exports` is the temporary workaround to export this internal package to JFoenix. Hopefully there is a bug in the JFoenix issue tracking system for this because its untenable to rely on JavaFX internal classes. – Alan Bateman May 07 '20 at 07:35
  • @Naman I added this to VM options in IntelliJ but I still get the same error. – kaiffeetasse May 07 '20 at 08:07
  • @AlanBateman I added `--add-exports javafx.graphics/com.sun.javafx.stage=com.jfoenix` as VM argument but unfortunately the error persists – kaiffeetasse May 07 '20 at 08:08

0 Answers0