简体   繁体   English

文件已被更新版本的 Java 运行时错误 SceneBuilder 编译

[英]File has been compiled by a more recent version of the Java Runtime error SceneBuilder

I've used JLink + JPackage to build a JavaFX app into a self-contained application.我已经使用 JLink + JPackage 将 JavaFX 应用程序构建为一个独立的应用程序。 I'm using JDK 14. However, when I try to open one of my FXML files in IntelliJ's Scenebuilder I get this error:我使用的是 JDK 14。但是,当我尝试在 IntelliJ 的 Scenebuilder 中打开我的 FXML 文件之一时,出现此错误:

File has been compiled by a more recent version of the Java Runtime (class file version 58.0), this version of the Java Runtime only recognizes class file versions up to 55.0.

To run the app in development environment, I use mvn clean javafx:run .要在开发环境中运行应用程序,我使用mvn clean javafx:run

When I check in the IDE's compiler settings, the JDK is correctly set to 14, and so is the JAVA_HOME variable, as shown below.当我检查 IDE 的编译器设置时,JDK 正确设置为 14, JAVA_HOME变量也是如此,如下所示。 How do I fix this?我该如何解决?

PS C:\dev> java --version
openjdk 14.0.2 2020-07-14
OpenJDK Runtime Environment (build 14.0.2+12-46)
OpenJDK 64-Bit Server VM (build 14.0.2+12-46, mixed mode, sharing)

I think (I'm not 100% sure but it makes sense) there are 2 answer's to this...我认为(我不是 100% 确定,但这是有道理的)对此有 2 个答案......

  1. Your intellij is using an older version of java (It can range from 6 to 13).您的 Intellij 使用的是旧版本的 java(范围从 6 到 13)。 So you would need to allow intellij to use a newer version of java (JDK14).因此,您需要允许 intellij 使用较新版本的 java (JDK14)。
  2. Build your application with older version of java, of course you might need to change some functions because of older version of java.使用较旧版本的 java 构建您的应用程序,当然由于较旧版本的 java,您可能需要更改某些功能。

I'd say the problem are your custom components.我会说问题在于您的自定义组件。 You have probably compiled them with Java 14 and put the resulting jars into SceneBuilder.您可能已经使用 Java 14 编译它们并将生成的 jars 放入 SceneBuilder。 So each time when you load an FXML file which uses one of these components you will get that error message because the class file version of your components is younger than the version of SceneBuilder itself.因此,每次加载使用这些组件之一的 FXML 文件时,您都会收到该错误消息,因为组件的类文件版本比 SceneBuilder 本身的版本年轻。 For compatibility reasons it would be a good idea to compile your components with a target 11 anyway.出于兼容性原因,无论如何用目标 11 编译您的组件是个好主意。 You can do that with your Java 14 compiler.您可以使用 Java 14 编译器执行此操作。 This would increase compatibility in general and solve you problem at hand.这通常会增加兼容性并解决您手头的问题。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何绕过 JNI 错误(Java vile version error)文件已被更新版本的 java 运行时编译 - How to bypass JNI error (Java vile version error) file has been compiled by more recent version of the java runtime UnsupportedClassVersionError: 已由较新版本的 Java Runtime(类文件版本 55.0)编译,此版本 (..) 高达 52.0 - UnsupportedClassVersionError: has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version (..)up to 52.0 SearchServlet已由更新版本的Java Runtime编译 - SearchServlet has been compiled by a more recent version of the Java Runtime CamelContextAware 已由 Java 运行时的更新版本编译 - CamelContextAware has been compiled by a more recent version of the Java Runtime 已由较新版本的 Java 运行时编译(类文件版本 57.0) - Has been compiled by a more recent version of the Java Runtime (class file version 57.0) JNI 错误:一个类已被更新版本的 Java 运行时编译 - JNI error : A class has been compiled by a more recent version of the Java Runtime org/testng/ITestListener 已由更新版本的 Java 运行时(类文件版本 55.0)编译,最多只能识别 52 版本 - org/testng/ITestListener has been compiled by a more recent version of the Java Runtime (class file version 55.0), only recognizes version up to 52 Docker 运行返回异常:应用程序已由 Java 运行时的更新版本编译 - Docker run returns an exception: Application has been compiled by a more recent version of the Java Runtime org/springframework/boot/maven/BuildInfoMojo 已由更新版本的 Java Runtime 编译 - org/springframework/boot/maven/BuildInfoMojo has been compiled by a more recent version of the Java Runtime Spring Boot Application 已由更新版本的 Java 运行时编译 - Spring Boot Application has been compiled by more recent version of Java runtime
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM