此语言级别不支持 Intellij 功能 (...).我无法编译 [英] intellij feature (...) not supported at this language level. I can't compile

查看:29
本文介绍了此语言级别不支持 Intellij 功能 (...).我无法编译的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

IntelliJ 向我展示了

SDK/JDK 与项目语言级别的匹配

要在编辑器中激活 Java 语言功能,您需要更改模块的项目结构模块设置以确保您的项目 SDK 匹配项目语言级别.

项目 SDK (JDK) Java 1.5 匹配项目语言级别 5 ...

Java 1.6 匹配语言级别 6 ...

Java 1.7 匹配语言级别 7,依此类推.

示例

根据您的 IntelliJ 版本,在项目窗格中的模块上按 F4Ctrl + Alt + Shift - S,或按 Ctrl + Shift -A 并键入项目结构"或模块设置"以打开项目结构"对话框.

项目设置部分下,点击列表中的第一项,项目.

在下面的屏幕截图中,项目 SDK 1.8 (java version '1.8.0_72') 匹配所选语言级别 SDK 默认(8 - Lambdas、类型注释等)代码>,因为 Java 1.8 与 SDK 级别 8 匹配.这会激活 Java 8 语言功能以在编辑器中使用.

如果您没有在 Project SDK 下设置 JDK,那就是另一个问题了.首先通过单击 New 并添加 JDK 来解决该问题.

IntelliJ is showing me this error

I just built my new computer and none of my java stuff is working... My regular Intellij was working when I first tried it, but my android studio would't install because it couldn't find the path to the jdk. Here is the question that I asked about that. Since that wasn't working, I had to reinstall java multiple times, and now my IntelliJ isn't working. Here is a picture of the error (I am getting an error that is telling me the for-each loops aren't supported at this language level).

I have tried to install the JDK on my D: drive and that didn't work. I am currently trying to use java 1.8u71 (have tried u65 and 1.7u47) except none of those have worked.

解决方案

IntelliJ is showing me this error

Matching the SDK/JDK with Project language level

To activate Java language features in the editor, you need to change your module's Project Structure or Module Settings to ensure your Project SDK matches the Project language level.

Project SDK (JDK) Java 1.5 matches project language level 5 ...

Java 1.6 matches language level 6 ...

Java 1.7 matches language level 7, and so on.

Example

Depending on your IntelliJ version, hit F4 or Ctrl + Alt + Shift - S on your module in the Project pane, or hit Ctrl + Shift - A and type either "Project Structure" or "Module Settings" to open the Project Structure dialog.

Under Project Settings section, click on the first item in the list, Project.

In the screenshot below, the Project SDK 1.8 (java version '1.8.0_72') matches the selected language level SDK Default (8 - Lambdas, type annotations etc.) because Java 1.8 matches SDK level 8. This activates the Java 8 language features for use in the editor.

If you don't have the JDK set up under Project SDK that is a different problem. Solve that one first by clicking New and adding a JDK.

这篇关于此语言级别不支持 Intellij 功能 (...).我无法编译的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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