有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java模块“项目”读取包“javafx”。来自两个javafx的bean。base和javafx。基地'

标题中的错误是我模块信息中的错误。JAVA我是Java新手,所以我希望在你给出答案时我能理解你的答案。 我发现这里的其他问题也提出了同样的问题,他们可能有答案,我只是不知道如何将其应用到我的情况中

javafx.base reads package javafx.beans

modular java project (IntelliJ IDEA): Module 'com.test' reads package 'javax.xml.bind' from both 'java.xml.bind' and 'java.xml.bind'

Package 'com.example' reads package 'javafx.beans' from both 'javafx.base' and 'javafx.base'

下面是该文件的外观:

module project{
    requires javafx.controls;
    requires javafx.fxml;
    requires sikulixapi;

    opens com.example to javafx.fxml;

    exports com.example;
}

当我注释掉两个javafx时。*如果需要行,错误就会消失

我使用Intellij Idea,创建了一个Javafx项目并添加了Maven

我将如何着手寻找这个问题的解决方案


共 (1) 个答案

  1. # 1 楼答案

    我认为这是一个智力问题。我在Eclipse中创建了Hello World JavaFX示例,没有遇到任何问题

    波姆。xml

    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
        <modelVersion>4.0.0</modelVersion>
        <groupId>demo</groupId>
        <artifactId>hello</artifactId>
        <version>0.0.1-SNAPSHOT</version>
        <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>13</version>
            </dependency>
             <dependency>
                <groupId>org.openjfx</groupId>
                <artifactId>javafx-fxml </artifactId>
                <version>17-ea+14</version>
            </dependency>
        </dependencies>
        <build>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.8.0</version>
                    <configuration>
                        <release>11</release>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.openjfx</groupId>
                    <artifactId>javafx-maven-plugin</artifactId>
                    <version>0.0.6</version>
                    <executions>
                        <execution>
                            <!  Default configuration for running  >
                            <!  Usage: mvn clean javafx:run  >
                            <id>default-cli</id>
                            <configuration>
                                <mainClass>demo.hello.App</mainClass>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </build>
    </project>
    

    模块信息。爪哇

    module demo.hello {
        requires javafx.controls;
        requires javafx.fxml;
        exports demo.hello;
    }