IllegalAccessError: class (in unnamed module) cannot access class com.sun.javafx.runtime.VersionInfo (in module javafx.base) because module javafx.base does not export com.sun.javafx.runtime to unnamed module

Issue #783 new
Fouad Almalki
created an issue

The following exception occurs when using NotificationPane through Webstart (works fine in normal environment):

Exception in thread "JavaFX Application Thread" java.lang.IllegalAccessError: class (in unnamed module @0x79b4759) cannot access class com.sun.javafx.runtime.VersionInfo (in module javafx.base) because module javafx.base does not export com.sun.javafx.runtime to unnamed module @0x79b4759
    at org.controlsfx.control.ControlsFXControl.<init>(
    at org.controlsfx.control.NotificationPane.<init>(
    at org.controlsfx.control.NotificationPane.<init>(
    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
    at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
    at java.base/java.lang.reflect.Constructor.newInstance(Unknown Source)
    at java.base/java.lang.Class.newInstance(Unknown Source)
    at javafx.fxml/javafx.fxml.FXMLLoader$InstanceDeclarationElement.constructValue(Unknown Source)
    at javafx.fxml/javafx.fxml.FXMLLoader$ValueElement.processStartElement(Unknown Source)
    at javafx.fxml/javafx.fxml.FXMLLoader.processStartElement(Unknown Source)
    at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(Unknown Source)
    at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(Unknown Source)
    at javafx.fxml/javafx.fxml.FXMLLoader.load(Unknown Source)
    /* unrelated lines removed */
    at$runLater$9(Unknown Source)
    at java.base/ Method)
    at$runLater$10(Unknown Source)
    at$ Source)
    at Method)
    at$runLoop$3(Unknown Source)
    at java.base/ Source)

Comments (4)

  1. Fouad Almalki reporter

    I tried to bypass the bug temporarily by fixing the version inside

    javaFXVersion         = "9";

    However, I got a new exception:

    com.sun.javafx.scene.traversal.ParentTraversalEngine (in module because module does not export  com.sun.javafx.scene.traversal to unnamed module @0x6bc89e63
        at org.controlsfx.control.NotificationPane.createDefaultSkin(
        at javafx.controls/javafx.scene.control.Control.doProcessCSS(
        at javafx.controls/javafx.scene.control.Control.access$000(
        at javafx.controls/javafx.scene.control.Control$1.doProcessCSS(
        at javafx.controls/com.sun.javafx.scene.control.ControlHelper.processCSSImpl(
        at java.base/ Method)
        at Method)
        at java.base/

    Again, this happens on webstart environment only.

  2. Abhinay Agarwal

    How do you create the WebStart? Do you use a gradle plugin or is it a manual process? If you layout the steps, may be I can try to reproduce the problem and suggest a solution for the same.

    Right now, most of the inaccessible packages are exported. Check the compile time args used to compile the project and also the runtime args used to run the sample application.

  3. Tobias Schulte

    You can use the following changes to create a webstart launcher:

    diff -r faac7afb953d controlsfx-samples/build.gradle
    --- a/controlsfx-samples/build.gradle   Sat Oct 21 15:55:05 2017 +0200
    +++ b/controlsfx-samples/build.gradle   Thu Nov 30 16:00:52 2017 +0100
    @@ -1,3 +1,6 @@
    +plugins {
    +    id "de.gliderpilot.jnlp" version "1.2.5"
     apply plugin: 'application'
     applicationName = 'FXSampler'
    @@ -44,3 +47,21 @@
         // For accessing InputMap used in RangeSliderBehavior
    +jnlp {
    +    // create key on the commandline:
    +    // `keytool -genkey -storepass storepass -alias mykey -dname "CN=Unknown, OU=Unknown, O=Unknown, L=Unknown, ST=Unknown, C=Unknown"`
    +    signJarParams = [
    +        alias: 'mykey',
    +        storepass: "storepass",
    +    ]
    +    usePack200 = false
    +    j2seParams = [version: "9", "java-vm-args": applicationDefaultJvmArgs.join(" ")]
    +    withXml {
    +        information {
    +            title
    +            vendor
    +        }
    +        security { "all-permissions"() }
    +    }

    You need to generate a certificate in your keystore first by using keytool -genkey -storepass storepass -alias mykey -dname "CN=Unknown, OU=Unknown, O=Unknown, L=Unknown, ST=Unknown, C=Unknown". You also need to add a security exception in the "Java Control Panel", tab "Security", click "Edit Site List", add "file:///".

    Then you can create the launcher with ./gradlew build. After that you can start the sample application with javaws controlsfx-samples/build/jnlp/launch.jnlp. It did not start on my machine. Only after adding

        // For VersionInfo
        // For ReflectionUtils

    to applicationDefaultJvmArgs, the application starts (you need to excecute ./gradlew cleanGenerateJnlp after such changes, because the generateJnlp task is not save in that regard yet.

  4. Log in to comment