我正在尝试使用 OpenJDK16 运行 JavaFX16 应用程序(应用程序本身是通过 Java 1.8 编写的)。不幸的是,每次运行我的应用程序时,我都会收到以下警告消息:
--- exec-maven-plugin:3.0.0:exec (default-cli) @ ListPlanWizard --- ???. 2021 年 1 月 14 日下午 12:46:53 com.sun.javafx.application.PlatformImpl 启动警告:不支持的 JavaFX 配置:从“未命名模块 @1cebc698”加载类
你能解释一下为什么我会得到它,我该如何避免这种情况?
请注意,与我在 Internet 上发现的此或类似警告的其他问题不同,我的应用程序在此之后不会崩溃或按预期工作。
另请注意,我使用此问题中的提示来避免 错误:缺少 JavaFX 运行时组件,并且需要运行此应用程序
我不在我的项目属性中使用外部 JavaFX OpenSDK 或其他东西。
我的 pom.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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>bla.blabla</groupId>
<artifactId>ListPlanWizard</artifactId>
<version>0.9.3</version>
<packaging>jar</packaging>
<name>ListPlanWizard</name>
<description>blablablablabla</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.4.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<start-class>bla.blabla.ListPlanWizard.Crutch</start-class>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<!-- Used to work with the older excel file format - .xls -->
<!-- https://mvnrepository.com/artifact/org.apache.poi/poi -->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.17</version>
</dependency>
<!-- Used to work with the newer excel file format - .xlsx -->
<!-- https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml -->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.17</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>16</version>
</dependency>
<dependency>
<groupId>com.github.ulisesbocchio</groupId>
<artifactId>jasypt-spring-boot-starter</artifactId>
<version>2.0.0</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.openjfx</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>0.0.6</version>
<configuration>
<mainClass>bla.blabla.ListPlanWizard.Crutch</mainClass>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<executable>java</executable>
<compilerArguments>
<excludeDevtools>true</excludeDevtools>
</compilerArguments>
</configuration>
</plugin>
</plugins>
</build>
</project>
Run Code Online (Sandbox Code Playgroud)
感谢您提前回答!
小智 0
// For Gradle ....
// Add the code in your 'build.gradle'.
// Javafx modules will be fetched from classpath...
// No warnings thereafter..
run {
doFirst {
jvmArgs = [
'--module-path', classpath.asPath,
'--add-modules', 'javafx.controls',
'--add-modules', 'javafx.fxml',
'--add-modules', 'javafx.graphics',
'--add-modules', 'javafx.base',
'--add-modules', 'javafx.swing',
]
}
}
Run Code Online (Sandbox Code Playgroud)