Skip to content

Instantly share code, notes, and snippets.

@sawaYch
Created June 17, 2020 12:06
Show Gist options
  • Select an option

  • Save sawaYch/863a922653f8193105ed9cc0f6b28b13 to your computer and use it in GitHub Desktop.

Select an option

Save sawaYch/863a922653f8193105ed9cc0f6b28b13 to your computer and use it in GitHub Desktop.
JFoenix JFXProgressBar fix

Problem: GUI thread Runtime Exception when using JFoenix JFXProgressBar.

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

If you are using Gradle, then direct modify the run configuration (through the dialog) will NOT work.
Go to build.gradle,

plugins {
    id 'java'
    id 'application'
    id 'org.openjfx.javafxplugin' version '0.0.8'
}

group 'org.harutya'
version '1.0-SNAPSHOT'

sourceCompatibility = 13

repositories {
    mavenCentral()
}

javafx {
    version = "13"
    modules = [ 'javafx.controls', 'javafx.graphics', 'javafx.fxml' ]
}

dependencies {
    testCompile group: 'junit', name: 'junit', version: '4.12'
    compile group: 'com.h2database', name: 'h2', version: '1.4.197'
    compile 'com.jfoenix:jfoenix:9.0.8'
    compile group: 'org.mindrot', name: 'jbcrypt', version: '0.4'
}

run{
    jvmArgs = [
            "--add-exports=javafx.graphics/com.sun.javafx.scene=ALL-UNNAMED",     // Add this line
            "--add-opens=java.base/java.lang.reflect=com.jfoenix"
    ]
}

mainClassName = 'org.harutya.Main'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment