Search code examples
javajavafxcontrolsfxrangeslider

Issues with RangeSlider from ControlsFX


I am trying to implement the RangeSlider class in a program, however, I am receiving the following error:

Exception in Application start method
java.lang.reflect.InvocationTargetException
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.base/java.lang.reflect.Method.invoke(Unknown Source)
    at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(Unknown Source)
    at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication(Unknown Source)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.base/java.lang.reflect.Method.invoke(Unknown Source)
    at java.base/sun.launcher.LauncherHelper$FXHelper.main(Unknown Source)
Caused by: java.lang.RuntimeException: Exception in Application start method
    at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication1(Unknown Source)
    at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(Unknown Source)
    at java.base/java.lang.Thread.run(Unknown Source)
Caused by: java.lang.IllegalAccessError: class impl.org.controlsfx.behavior.RangeSliderBehavior (in unnamed module @0x74bf073e) cannot access class com.sun.javafx.scene.control.inputmap.InputMap$Mapping (in module javafx.controls) because module javafx.controls does not export com.sun.javafx.scene.control.inputmap to unnamed module @0x74bf073e
    at impl.org.controlsfx.behavior.RangeSliderBehavior.<init>(RangeSliderBehavior.java:67)
    at impl.org.controlsfx.skin.RangeSliderSkin.<init>(RangeSliderSkin.java:95)
    at org.controlsfx.control.RangeSlider.createDefaultSkin(RangeSlider.java:194)
    at javafx.controls/javafx.scene.control.Control.doProcessCSS(Unknown Source)
    at javafx.controls/javafx.scene.control.Control.access$000(Unknown Source)
    at javafx.controls/javafx.scene.control.Control$1.doProcessCSS(Unknown Source)
    at javafx.controls/com.sun.javafx.scene.control.ControlHelper.processCSSImpl(Unknown Source)
    at javafx.graphics/com.sun.javafx.scene.NodeHelper.processCSS(Unknown Source)
    at javafx.graphics/javafx.scene.Parent.doProcessCSS(Unknown Source)
    at javafx.graphics/javafx.scene.Parent.access$400(Unknown Source)
    at javafx.graphics/javafx.scene.Parent$1.doProcessCSS(Unknown Source)
    at javafx.graphics/com.sun.javafx.scene.ParentHelper.processCSSImpl(Unknown Source)
    at javafx.graphics/com.sun.javafx.scene.NodeHelper.processCSS(Unknown Source)
    at javafx.graphics/javafx.scene.Parent.doProcessCSS(Unknown Source)
    at javafx.graphics/javafx.scene.Parent.access$400(Unknown Source)
    at javafx.graphics/javafx.scene.Parent$1.doProcessCSS(Unknown Source)
    at javafx.graphics/com.sun.javafx.scene.ParentHelper.processCSSImpl(Unknown Source)
    at javafx.graphics/com.sun.javafx.scene.NodeHelper.processCSS(Unknown Source)
    at javafx.graphics/javafx.scene.Parent.doProcessCSS(Unknown Source)
    at javafx.graphics/javafx.scene.Parent.access$400(Unknown Source)
    at javafx.graphics/javafx.scene.Parent$1.doProcessCSS(Unknown Source)
    at javafx.graphics/com.sun.javafx.scene.ParentHelper.processCSSImpl(Unknown Source)
    at javafx.graphics/com.sun.javafx.scene.NodeHelper.processCSS(Unknown Source)
    at javafx.graphics/javafx.scene.Node.processCSS(Unknown Source)
    at javafx.graphics/javafx.scene.Scene.doCSSPass(Unknown Source)
    at javafx.graphics/javafx.scene.Scene.preferredSize(Unknown Source)
    at javafx.graphics/javafx.scene.Scene$2.preferredSize(Unknown Source)
    at javafx.graphics/com.sun.javafx.scene.SceneHelper.preferredSize(Unknown Source)
    at javafx.graphics/javafx.stage.Window$12.invalidated(Unknown Source)
    at javafx.base/javafx.beans.property.BooleanPropertyBase.markInvalid(Unknown Source)
    at javafx.base/javafx.beans.property.BooleanPropertyBase.set(Unknown Source)
    at javafx.graphics/javafx.stage.Window.setShowing(Unknown Source)
    at javafx.graphics/javafx.stage.Window.show(Unknown Source)
    at javafx.graphics/javafx.stage.Stage.show(Unknown Source)
    at minimalist.DoubleSliderInterface.start(DoubleSliderInterface.java:104)
    at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$9(Unknown Source)
    at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runAndWait$11(Unknown Source)
    at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$9(Unknown Source)
    at java.base/java.security.AccessController.doPrivileged(Native Method)
    at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(Unknown Source)
    at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(Unknown Source)
    at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
    at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(Unknown Source)
    ... 1 more
Exception running application minimalist.DoubleSliderInterface

I am using ControlsFX version 9.0.0 while running Java 10 on Eclipse, however, I believe I can rule out incompatibility with the Java version as I also tried running this on Java 9.0.4 and as well was able to successfully run the Rating class.

My code is just a number of instances of the following, succeeded by a VBox to contain them, a group, and the scene and stage as is normal-

        final RangeSlider blur = new RangeSlider(0,30,0,30);
        Text blurTitle = new Text("Blur");
        Text blurMin = new Text();
        blurMin.textProperty().bindBidirectional(blur.lowValueProperty(),converter);
        Text blurMax = new Text();
        blurMax.textProperty().bindBidirectional(blur.highValueProperty(),converter);
        HBox blurBox = new HBox();
        blurBox.getChildren().addAll(blurMin,blur,blurMax);
        blurBox.setPadding(new Insets(5));
        blurBox.setSpacing(10);

Any help is appreciated, thanks.


Solution

  • Adding --add-exports=javafx.controls/com.sun.javafx.scene.control.inputmap=ALL-UNNAMED to your VM arguments when running the application will resolve the issue. Answer thanks to @kleopatra