![](/img/trans.png)
[英]UnsupportedClassVersionError: has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version (..)up to 52.0
[英]Getting java error: compiled by a more recent version of the Java Runtime (class file version 53.0)
在这里,我正在使用 Maven 3.2.5 运行 JDK-8,我的代码构建正在成功
启动应用程序后,我收到以下错误:
Caused by: java.lang.UnsupportedClassVersionError: com/daimler/duke/common/faults/CommonServiceFacadeFault has been compiled by a more recent version of the Java Runtime (class file version 53.0), this version of the Java Runtime only recognizes class file versions up to 52.0
at java.lang.ClassLoader.defineClass1(Native Method) ~[na:1.8.0_162]
我也对此进行了探讨,一些博客显示应用程序正在 Java 9 中编译,并尝试在 Java 8 中运行
我的 pom.xml 文件是:
<project>
.............
.............
<properties>
<tycho.version>1.2.0</tycho.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<repositories>
...........
</repositories>
<pluginRepositories>
...........
</pluginRepositories>
<build>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>target-platform-configuration</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jarsigner-plugin</artifactId>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-maven-plugin</artifactId>
<version>${tycho.version}</version>
<extensions>true</extensions>
</plugin>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>target-platform-configuration</artifactId>
<version>${tycho.version}</version>
<configuration>
<environments>
<environment>
<os>win32</os>
<ws>win32</ws>
<arch>x86_64</arch>
</environment>
</environments>
<dependency-resolution>
<extraRequirements>
<requirement>
<type>eclipse-plugin</type>
<id>org.eclipse.core.runtime</id>
<versionRange>0.0.0</versionRange>
</requirement>
<requirement>
<type>eclipse-plugin</type>
<id>org.eclipse.ui.ide</id>
<versionRange>0.0.0</versionRange>
</requirement>
</extraRequirements>
</dependency-resolution>
</configuration>
</plugin>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-packaging-plugin</artifactId>
<version>${tycho.version}</version>
</plugin>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-compiler-plugin</artifactId>
<configuration>
<compilerArgument>-warn:none</compilerArgument>
<compilerArgument>-err:none</compilerArgument>
<useProjectSettings>false</useProjectSettings>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
有没有人对此有想法?
注意:由于应用程序依赖性,我不能在这里使用 java 9。
修复 JDK 版本问题后,您需要运行clean
任务以重新编译所有类:
mvn clean package
如果您不添加clean
某些类不会被编译并且错误仍然存在。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.