fileversion 55.0 this version of the Java Runtime only recognizes class file versions up to 52.0:已解决

问题描述

运行时会报错:java:无法访i问org.testng.annotations.AfterTest
错误的类文件:/D:/repository/org/testng/testng/7.6.l/testng-7.6.1.jarI/org/testng/annotations/AfterTest.class
类文件具有错误的版本55.0,应为52,0请删除该文件或确保该文件位于正确的类路径子目录中,如下图所示。

在这里插入图片描述

即便是运行通过,在向执行过程中依然会报错:

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

解决方法

我们在idea下找到setting,如下图所示。

在这里插入图片描述
进入新界面后,我们找到Build Exceution,Deployment,找到Compiler下的Java Compiler,确保使用的jdk版本与Project bytecode versiore中填写的版本一致,如果使用的是2020以上的idea,Project bytecode versiore中1.8也可以写成8,如下图所示。

在这里插入图片描述
再找到设置下的Project Structure,如下图所示

在这里插入图片描述
确保这里的版本也使用一致,如下图所示。

在这里插入图片描述
我们在回到代码界面,按下Ctrl+N,打开搜索框,点击ALL,在全部中搜索Run/Debug Configurations,如下图所示。

在这里插入图片描述
我们选择第一项Edit Configurations进入其中,确保这里的JRE版本也一致,如下图所示。

在这里插入图片描述
还需要注意的有:在poml等等的.xml文件中对jdk的描述,写1.8或者是11,即target=“1.8”,此处不可写8

文章参考

http://t.csdn.cn/2ysk2


以上就是本文全部内容,如果它对您有帮助,请您帮我点个赞,这对我真的很重要

  • 4
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
Java Runtime Environment (JRE) refers to the software environment that includes the Java Virtual Machine (JVM) and the necessary libraries for running Java applications. A class file is a compiled form of Java source code, containing bytecode, which can be executed by the JVM. The "class file version 61.0" you mentioned does not seem to correspond to an official version number in the standard Java specification. Java class files have version numbers based on the Java platform version they were designed to work with, following a format like `major.minor`. For example, version 61.0 might be a custom or non-standard build, or it could indicate a modified version with custom extensions. Java standard class file formats are defined up to version 55.0, corresponding to Java SE 8. Here's what you need to know about the standard class file formats: - **Java SE 5**: Class file version 49.0 - **Java SE 6**: Class file version 50.0 - **Java SE 7**: Class file version 51.0 - **Java SE 8**: Class file version 52.0 If your JRE is limited to recognizing class files up to version 55.0, it means it may not support newer features introduced in later Java versions, and any application with a higher class file version may encounter issues or require a more recent JRE for proper execution. Here are some related questions: 1. What are the main differences between Java versions regarding class file format changes? 2. Can you run Java SE 9 or later applications on a JRE with version 55.0? 3. How can one ensure compatibility between older and newer class files when deploying applications?

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值