概述
i was trying to create compile my application and create an executable file. as for now i see the best tool to use is javafx-maven-plugin.
i couldn't get it to work, so i started with a basic code that is generated when creating a project according to this.
the basic example works but when i tried the same structure in my code or by simply adding a code that contains jfoenix to it. it cannot run.
following line seems to be the important line of the error,
Caused by: java.lang.IllegalAccessError: class com.jfoenix.skins.JFXSpinnerSkin (in module com.jfoenix) cannot access class com.sun.javafx.scene.NodeHelper (in module javafx.graphics) because module javafx.graphics does not export com.sun.javafx.scene to module com.jfoenix
how can i fix this?
this is pom i has sofar.
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
4.0.0
org.openjfx
test
1.0-SNAPSHOT
jar
UTF-8
11
11
org.openjfx
javafx-controls
14
org.openjfx
javafx-fxml
14
org.openjfx
javafx-media
14
org.openjfx
javafx-graphics
14
org.openjfx
javafx-base
14
com.jfoenix
jfoenix
9.0.9
org.apache.maven.plugins
maven-compiler-plugin
3.8.0
11
--add-opensjavafx.graphics/com.sun.javafx.scene=ALL-UNNAMED
org.openjfx
javafx-maven-plugin
0.0.3
org.openjfx.App
--add-opens
javafx.graphics/com.sun.javafx.scene=ALL-UNNAMED
解决方案
I edited and the POM so that it runs, and this is the output I see
I am sharing the POM below, just use this POM and it should work.
Apart from this you must use JDK 11.0.2 or lower. You need to change settings of your IDE to pick up JDK 11.0.2 or lower for this project.
Because you are using features of JFoenix which will not work with a higher version of JDK. Reason is explained here : https://github.com/jfoenixadmin/JFoenix/issues/955
With this you will be able to make this code run on mobile (64-bit android and iPhone ) using GluonVM, and Desktop, Linux, Mac, and web (using JPro), rasberry pie etc. So practically you cannot have any problem with this unless you have a very big reason for wanting to upgrade to Jdk 12. If you give time, may be a year, I am sure JFoenix team will fix it, if it is not done, and you really find JFoenix very useful you can either pitch in and contribute the fixes or use something else.
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
4.0.0
org.openjfx
test
1.0-SNAPSHOT
jar
UTF-8
11
11
org.openjfx
javafx-fxml
11
org.openjfx
javafx-controls
11
org.openjfx
javafx-graphics
11
com.jfoenix
jfoenix
9.0.9
io.datafx
datafx
8.0.7
io.datafx
flow
8.0.7
org.kordamp.ikonli
ikonli-javafx
11.4.0
org.kordamp.ikonli
ikonli-fontawesome5-pack
11.4.0
org.openjfx
javafx-maven-plugin
0.0.4
org.openjfx.App
--add-opensjavafx.graphics/com.sun.javafx.scene=ALL-UNNAMED
--add-opensjavafx.controls/com.sun.javafx.scene.control.behavior=ALL-UNNAMED
--add-opensjavafx.controls/com.sun.javafx.scene.control=ALL-UNNAMED
--add-opensjavafx.base/com.sun.javafx.binding=ALL-UNNAMED
--add-opensjavafx.graphics/com.sun.javafx.stage=ALL-UNNAMED
--add-opensjavafx.base/com.sun.javafx.event=ALL-UNNAMED
--add-exportsjavafx.controls/com.sun.javafx.scene.control.behavior=ALL-UNNAMED
--add-exportsjavafx.controls/com.sun.javafx.scene.control=ALL-UNNAMED
--add-exportsjavafx.base/com.sun.javafx.binding=ALL-UNNAMED
--add-exportsjavafx.graphics/com.sun.javafx.stage=ALL-UNNAMED
--add-exportsjavafx.base/com.sun.javafx.event=ALL-UNNAMED
最后
以上就是活泼芝麻为你收集整理的java fx stage,如何使用javafx-maven-plugin运行包含jfoenix的maven Java fx项目的全部内容,希望文章能够帮你解决java fx stage,如何使用javafx-maven-plugin运行包含jfoenix的maven Java fx项目所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复