英文:
Module javafx.base not found in java 13
问题
我已经配置了JavaFX 11与OpenJDK 13。我已经将PATH_TO_FX
静态地添加到JavaFX的位置。
并且在项目结构中,我已经配置了OpenJDK 13,但仍然出现错误,提示在Java 11中未找到JavaFX基本模块
。
英文:
I have configured javafx 11 with openjdk 13. I have added the PATH_TO_FX
statically to the location of javafx.
And in project structure I have configured openjdk 13 but still it is giving the error Module javafx.base not found in java 11
答案1
得分: 2
每个集成开发环境(IDE)都可以处理Maven或Gradle项目。搜索"Maven repo openjfx",你会找到要添加的库依赖。由于可以预期会有许多模块和JAR文件,最好使用类似Maven这样的工具。搜索示例。
一个 pom.xml 文件可能包含以下OpenJFX依赖项。我已经为你复制了适用于你正在使用的Java 13的依赖项。
<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>junaid.muhammad</groupId>
<artifactId>myjavafx</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>13</maven.compiler.source>
<maven.compiler.target>13</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-base</artifactId>
<version>13.0.2</version>
</dependency>
<!-- 其他 OpenJFX 依赖项 -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>3.0.0-M5</version>
<configuration>
<argLine>--illegal-access=permit</argLine>
</configuration>
</plugin>
<plugin>
<!-- 可能是 JavaFX 插件 -->
<groupId>org.openjfx</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>0.0.4</version>
<configuration>
<mainClass>.. MyApp</mainClass>
</configuration>
</plugin>
</plugins>
</build>
</project>
希望你能看到优势:JavaFX 由多个模块组成。
英文:
Every IDE can do maven or gradle projects. Search for maven repo openjfx and you'll find the (library) dependency to add. As one can expect many modules, jars, better use such a tool as maven. Search examples.
A pom.xml might contain the following OpenJFX dependencies. I have copied them for java 13, which you are using too.
<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>junaid.muhammad</groupId>
<artifactId>myjavafx</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>13</maven.compiler.source>
<maven.compiler.target>13</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-base</artifactId>
<version>13.0.2</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>13.0.2</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-graphics</artifactId>
<version>13.0.2</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-web</artifactId>
<version>13.0.2</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>3.0.0-M5</version>
<configuration>
<argLine>--illegal-access=permit</argLine>
</configuration>
</plugin>
<plugin>
<!-- Maybe the JavaFX plugin -->
<groupId>org.openjfx</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>0.0.4</version>
<configuration>
<mainClass>.. MyApp</mainClass>
</configuration>
</plugin>
</plugins>
</build>
</project>
I'll hope you see the advantage: there are several modules that make up JavaFX.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论