2

I tried adding a JFXProgressBar component, then I get the exception below :

Exception in thread "JavaFX Application Thread" java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
    at javafx.fxml/javafx.fxml.FXMLLoader$MethodHandler.invoke(FXMLLoader.java:1787)
    at javafx.fxml/javafx.fxml.FXMLLoader$ControllerMethodEventHandler.handle(FXMLLoader.java:1670)
    at javafx.base/com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86)
.... (I skipped some lines for visibility purposes)
Caused by: java.lang.IllegalAccessError: class com.jfoenix.skins.JFXProgressBarSkin (in unnamed module @0x5680343f) cannot access class com.sun.javafx.scene.NodeHelper (in module javafx.graphics) because module javafx.graphics does not export com.sun.javafx.scene to unnamed module @0x5680343f
    at com.jfoenix.skins.JFXProgressBarSkin.<init>(JFXProgressBarSkin.java:64)
    at com.jfoenix.controls.JFXProgressBar.createDefaultSkin(JFXProgressBar.java:75)
    at javafx.controls/javafx.scene.control.Control.doProcessCSS(Control.java:897)
    at javafx.controls/javafx.scene.control.Control$1.doProcessCSS(Control.java:89)
    at 
...

When i remove the JFXProgressBar the program runs normally

I'm using javafx v14, jfoenix v9, java jdk 11.0.6.

enter image description here

Should i downgrade the java jdk version? or are there alternative solutions?

Minimal reproducible example:

Main.java:

package application;
import javafx.application.Application;
import javafx.stage.Stage;
import javafx.scene.Scene;
import javafx.scene.layout.AnchorPane;
import javafx.fxml.FXMLLoader;


public class Main extends Application {
    @Override
    public void start(Stage primaryStage) {
        try {
            AnchorPane root = (AnchorPane)FXMLLoader.load(getClass().getResource("Sample.fxml"));
            Scene scene = new Scene(root,400,400);
            primaryStage.setScene(scene);
            primaryStage.show();
        } catch(Exception e) {
            e.printStackTrace();
        }
    }
    
    public static void main(String[] args) {
        launch(args);
    }
}

Simple.fxml:

<?xml version="1.0" encoding="UTF-8"?>

<?import com.jfoenix.controls.JFXProgressBar?>
<?import javafx.scene.layout.AnchorPane?>


<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1">
   <children>
      <JFXProgressBar layoutX="200.0" layoutY="199.0" />
   </children>
</AnchorPane>
h3t1
  • 1,126
  • 2
  • 18
  • 29
  • [mcve] please.. – kleopatra Apr 09 '20 at 21:51
  • Thanks for responding, I updated the question to include the minimal reproducible example – h3t1 Apr 09 '20 at 23:17
  • 2
    the error message tells you what to do: _module javafx.graphics does not export com.sun.javafx.scene to unnamed module_ - take it literally and translate into a runtime argument `--add-exports javafx.graphics/com.sun.javafx.scene=ALL-UNNAMED` – kleopatra Apr 10 '20 at 10:03

0 Answers0