如何修复“不受支持的类文件主版本60",在IntelliJ中? [英] How to fix "unsupported class file major version 60" in IntelliJ?

查看:1952
本文介绍了如何修复“不受支持的类文件主版本60",在IntelliJ中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Ubuntu中有一个Gradle项目.它是用Java 14编写的.我已经安装了Java 14 JDK.当我从命令行构建它时,一切正常,但是没有人愿意使用命令行!当我在IntelliJ Idea中打开它时,它会引发错误:

I have a Gradle project in Ubuntu. It's written in Java 14. I have the Java 14 JDK installed. When I build it from the command line, everything works, but no one wants to use a command line! When I open it in IntelliJ Idea, it throws an error:

* Where:
Initialization script '/tmp/ijmapper.gradle`

* What went wrong:
Could not compile initialization script '/tmp/ijmapper.gradle`.
> Startup failed:
General error during semantic analysis: Unsupported class file major version 60.

后面是一个漫长而无助的堆栈跟踪,该跟踪说明了很多有关Groovy的信息.(该项目不是Groovy项目;它是Java项目.)

followed by a long, unhelpful stack trace that says a lot about Groovy. (The project is not a Groovy project; it's a Java project.)

主要版本60指的是Java 16,该项目未使用.我已经进入项目结构并确保将其设置为使用JDK版本14.建议这与IntelliJ特别相关,这很可能是IDE问题,而不是项目问题.

Major version 60 refers to Java 16, which this project is not using. I've already gone into Project Structure and made sure that it's set to use JDK version 14. But the name "ijmapper" suggests that this has something to do with IntelliJ specifically, and this is likely an IDE problem rather than a project problem.

映射器文件只是说:

if(!ext.has('mapPath'))ext.mapPath = {path->路径}

换句话说,就是一个简单的polyfill.

A simple polyfill, in other words.

有人知道这里发生了什么以及如何解决吗?我已经迷失了一天,试图使它正常工作,我快要死了!

Does anyone have any idea what's going on here and how to fix it? I've lost a day already trying to get this to work and I'm about at my wits' end here!

推荐答案

我通过更改IntelliJ设置中的Gradle JVM设置来解决此问题:

I fixed this problem by changing the Gradle JVM settings in IntelliJ settings:

  • 在"设置/首选项"对话框中,转到"构建,执行,部署" |设置".生成工具|摇篮.

Gradle 部分下,更改 Gradle JVM optinon.

Under the Gradle section, change the Gradle JVM optinon.

请参见 https://www.jetbrains.com/help/idea/gradle-jvm-selection.html#jvm_settings

这篇关于如何修复“不受支持的类文件主版本60",在IntelliJ中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆