Java 11 中的 JFoenix

这是我的 pom.xml 文件,用于在我的项目中使用 javafx 11 和 JFoenix 9。但是当我用 maven 编译和运行 javafx 时,它得到了这个错误:


Caused by: java.lang.IllegalAccessError: class com.jfoenix.skins.JFXGenericPickerSkin (in module com.jfoenix) cannot access class com.sun.javafx.binding.ExpressionHelper (in module javafx.base) because module javafx.base does not export com.sun.javafx.binding to module com.jfoenix

我已将此命令添加到编译选项:


--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

仍然没有任何变化。有人可以帮我解决吗?我正在使用 Intellij IDEA 和 Java 11.0.3。


我的 module-info.java 文件:


module com {

requires javafx.controls;

requires javafx.fxml;

requires javafx.base;

requires javafx.graphics;

requires com.jfoenix;


opens com.Client.Controller to javafx.fxml;

exports com;

}

我的 pom.xml 文件:


<properties>

    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

    <maven.compiler.source>11</maven.compiler.source>

    <maven.compiler.target>11</maven.compiler.target>

</properties>

<dependencies>

    <dependency>

        <groupId>org.openjfx</groupId>

        <artifactId>javafx-controls</artifactId>

        <version>11.0.2</version>

    </dependency>

    <dependency>

        <groupId>org.openjfx</groupId>

        <artifactId>javafx-fxml</artifactId>

        <version>11.0.2</version>

    </dependency>

    <dependency>

        <groupId>org.openjfx</groupId>

        <artifactId>javafx-base</artifactId>

        <version>11.0.2</version>

    </dependency>

    <dependency>

        <groupId>org.openjfx</groupId>

        <artifactId>javafx-graphics</artifactId>

        <version>11.0.2</version>

    </dependency>


幕布斯7119047
浏览 125回答 1
1回答

桃花长相依

将编译选项添加到 pom.xml 文件中,如下所示:<plugin>&nbsp; &nbsp; <groupId>org.openjfx</groupId>&nbsp; &nbsp; <artifactId>javafx-maven-plugin</artifactId>&nbsp; &nbsp; <version>0.0.1</version>&nbsp; &nbsp; <configuration>&nbsp; &nbsp; &nbsp; &nbsp; <options>&nbsp; &nbsp; &nbsp; &nbsp; <option>--add-opens</option>&nbsp; &nbsp; &nbsp; &nbsp; <option>javafx.controls/com.sun.javafx.scene.control.behavior=com.jfoenix</option>&nbsp; &nbsp; &nbsp; &nbsp; <option>--add-opens</option>&nbsp; &nbsp; &nbsp; &nbsp; <option>javafx.controls/com.sun.javafx.scene.control=com.jfoenix</option>&nbsp; &nbsp; &nbsp; &nbsp; <option>--add-exports</option>&nbsp; &nbsp; &nbsp; &nbsp; <option>javafx.controls/com.sun.javafx.scene.control.behavior=com.jfoenix</option>&nbsp; &nbsp; &nbsp; &nbsp; <option>--add-exports</option>&nbsp; &nbsp; &nbsp; &nbsp; <option>javafx.controls/com.sun.javafx.scene.control=com.jfoenix</option>&nbsp; &nbsp; &nbsp; &nbsp; <option>--add-exports</option>&nbsp; &nbsp; &nbsp; &nbsp; <option>javafx.base/com.sun.javafx.binding=com.jfoenix</option>&nbsp; &nbsp; &nbsp; &nbsp; <option>--add-exports</option>&nbsp; &nbsp; &nbsp; &nbsp; <option>javafx.graphics/com.sun.javafx.stage=com.jfoenix</option>&nbsp; &nbsp; &nbsp; &nbsp; <option>--add-exports</option>&nbsp; &nbsp; &nbsp; &nbsp; <option>javafx.base/com.sun.javafx.event=com.jfoenix</option>&nbsp; &nbsp; &nbsp; &nbsp; </options>&nbsp; &nbsp; &nbsp; &nbsp; <mainClass>com.App</mainClass>&nbsp; &nbsp; </configuration></plugin>
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Java