Issue
It's been 3 days that I look on the internet how to fix this on gradle
Caused by: java.lang.IllegalAccessError: class com.jfoenix.skins.JFXTabPaneSkin (in module com.jfoenix) cannot access class com.sun.javafx.scene.control.behavior.TabPaneBehavior (in module javafx.controls) because module javafx.controls does not export com.sun.javafx.scene.control.behavior to module com.jfoenix
On simple idea projects I was adding
--add-exports javafx.controls/com.sun.javafx.scene.control.behavior=com.jfoenix --add-exports javafx.controls/com.sun.javafx.scene.control=com.jfoenix --add-exports javafx.base/com.sun.javafx.binding=com.jfoenix --add-exports javafx.graphics/com.sun.javafx.stage=com.jfoenix --add-exports javafx.base/com.sun.javafx.event=com.jfoenix
I know, I have to add jvm options but how do I ?
I'm using gradle javafx 11.0.2, java 11, on intellij idea,
this is the build.gradle
plugins {
id 'java'
id 'application'
id 'org.openjfx.javafxplugin' version '0.0.8'
}
compileJava.options.encoding = 'UTF-8'
repositories {
mavenCentral()
}
dependencies {
// https://mvnrepository.com/artifact/com.jfoenix/jfoenix
compile group: 'com.jfoenix', name: 'jfoenix', version: '9.0.9'
compile group: 'de.jensd', name: 'fontawesomefx-fontawesome', version: '4.7.0-9.1.2'
// https://mvnrepository.com/artifact/de.jensd/fontawesomefx-commons
runtime group: 'de.jensd', name: 'fontawesomefx-commons', version: '9.1.2'
// https://mvnrepository.com/artifact/com.h2database/h2
compile group: 'com.h2database', name: 'h2', version: '1.4.199'
}
javafx {
version = "11.0.2"
modules = [ 'javafx.controls', 'javafx.fxml','javafx.graphics','javafx.base' ]
}
mainClassName = 'org.yanisboukir.agence.Main'
Thanks
Solution
If you are running a non modular project (you don't have module-info.java
), to include the VM arguments in your run task, all you need to add to your build.gradle
file is:
run {
jvmArgs = [
"--add-exports=javafx.controls/com.sun.javafx.scene.control.behavior=ALL-UNNAMED",
"--add-exports=javafx.controls/com.sun.javafx.scene.control=ALL-UNNAMED",
"--add-exports=javafx.base/com.sun.javafx.binding=ALL-UNNAMED",
"--add-exports=javafx.graphics/com.sun.javafx.stage=ALL-UNNAMED",
"--add-exports=javafx.controls/com.sun.javafx.scene.control.behavior=ALL-UNNAMED"
]
}
Note that in this case, you can't use --add-exports=...=com.jfoenix
.
If you run a modular project, with a module descriptor like:
module hellofx {
requires javafx.controls;
requires javafx.fxml;
requires com.jfoenix;
opens org.openjfx to javafx.fxml;
exports org.openjfx;
}
now these are the VM arguments that you will have to include in your build file:
run {
jvmArgs = [
"--add-exports=javafx.controls/com.sun.javafx.scene.control.behavior=com.jfoenix",
"--add-exports=javafx.controls/com.sun.javafx.scene.control=com.jfoenix",
"--add-exports=javafx.base/com.sun.javafx.binding=com.jfoenix",
"--add-exports=javafx.graphics/com.sun.javafx.stage=com.jfoenix",
"--add-exports=javafx.controls/com.sun.javafx.scene.control.behavior=com.jfoenix"
]
}
Answered By - José Pereda
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.