2

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.

  • 1
    Are you definitely using [version 9 of controlsfx](http://search.maven.org/#artifactdetails%7Corg.controlsfx%7Ccontrolsfx%7C9.0.0%7C)? Version 8.x won't have the required module dependencies declared, and so you'll get module errors like this. – Michael Berry Aug 06 '18 at 13:54
  • Yes, the file is named correctly and downloaded from the link provided by-http://fxexperience.com/controlsfx/ and I have checked again by redownloading the file. – Politic Revolutionnaire Aug 06 '18 at 14:28
  • 2
    `--add-exports javafx.controls/com.sun.javafx.scene.control.inputmap= ALL-UNNAMED` to the runtime config Actually, the error messages are very helpful - whenever there's some "not accessible because ..." you can add that exact reason as runtime parameter – kleopatra Aug 07 '18 at 09:51
  • Apparently, the addition needs to be exactly '--add-exports=javafx.controls/com.sun.javafx.scene.control.inputmap=ALL-UNNAMED' with that exact spacing and such for eclipse to recognise it. Thank you for your comment! – Politic Revolutionnaire Aug 08 '18 at 14:18

2 Answers2

2

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

1

There is already a bug report on their bitbucket page. It looks like it's just not compatible with java9+

https://bitbucket.org/controlsfx/controlsfx/issues/802/rangeslider-uses-inaccessable-package

I didn't read the code of this specific control but you might be able to copy the code you need and remove the part that uses the InputMap related classes.

Other than that you are probably better off downgrading to java8 or using another ui element to mimic similar behavior.

Selim
  • 1,064
  • 11
  • 23