Java:错误:不支持发布版本 13
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/56415859/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Java: error: release version 13 not supported
提问by mmassyn
I'm very new to coding and don't understand much yet. I'm running a small program that should give the output Hello World! I'm getting an error java.release version 13 not supported. Anyone that can explain how to fix this please?
我对编码很陌生,还不太了解。我正在运行一个小程序,它应该提供输出 Hello World!我收到一个错误 java.release version 13 not supported。任何人都可以解释如何解决这个问题?
回答by MNEMO
Try "File" menu >> "Project Structure..."
尝试“文件”菜单>>“项目结构...”
And then click "Project Settings >> Modules" on left side pane.
然后单击左侧窗格中的“项目设置>>模块”。
When selecting "Sources" tab on right-most pane, you would see "Language level:" drop-down, and you might see "13" being selected.
在最右侧的窗格中选择“来源”选项卡时,您会看到“语言级别:”下拉菜单,您可能会看到“13”被选中。
Try switching it to 12 or lower, the Error should be removed.
尝试将其切换到 12 或更低,错误应该被删除。
回答by tpikachu
As @MNEMO shared, the low down your target java version to under 13 will be working. Seems only v11 JDK added to your intelliJ. But if you are stilling targeting to Java v13 or your project requires v13 then you can add the JDK to your intelliJ
正如@MNEMO 所分享的那样,将您的目标 Java 版本降低到 13 以下将起作用。似乎只有 v11 JDK 添加到您的 IntelliJ 中。但是,如果您仍然针对 Java v13 或您的项目需要 v13,那么您可以将 JDK 添加到您的 IntelliJ
File-> Project Structure-> Project Settings(nav) -> Project-> Project SDK
文件->项目结构->项目设置(导航) ->项目->项目 SDK
Just clicking the New...to add newer JDK to your intelliJ. You can find the JDK at /Library/Java if you are using MacOS and installed java v13.
只需单击New...即可将更新的 JDK 添加到您的 IntelliJ。如果您使用的是 MacOS 并安装了 java v13,则可以在 /Library/Java 中找到 JDK。
It works for me well.
它对我很有效。
回答by Garry Dias
There's a? lot of places you must check:
有一个?很多地方你必须检查:
File -> Project Structure
Edit Configurations (in drop down near RUN button)
File -> Settings -> search for SDK
文件 -> 项目结构
编辑配置(在 RUN 按钮附近的下拉菜单中)
文件 -> 设置 -> 搜索 SDK
But what really worked for me after set everything above to my correctly Java 11 version was change this setting:
但是在将上述所有内容设置为我正确的 Java 11 版本后,真正对我有用的是更改此设置:
- File -> Settings -> Build, Execution, Deployment -> Compiler -> Java Copiler -> Project Bytecode Version
- File -> Settings -> Build, Execution, Deployment -> Compiler -> Java Copiler -> Project Bytecode Version
This setting was pointing to Java 13, so I changed to Java 11 and everything started to work as expected
此设置指向 Java 13,因此我更改为 Java 11,一切都开始按预期工作
Good luck
祝你好运
回答by Shravan Ramamurthy
I encountered the same error in IntelliJ, Above solutions didn't work for me, as I am using maven 3.6.3
in my project. Setting the proper jdk version (in my case, JDK-1.8) under maven profiles tool box, in IntelliJ, resolved my issue.
我在 IntelliJ 中遇到了同样的错误,上述解决方案对我不起作用,因为我3.6.3
在我的项目中使用了 maven 。在 IntelliJ 中的 maven 配置文件工具箱下设置正确的 jdk 版本(在我的情况下为 JDK-1.8)解决了我的问题。
回答by Emil Andrag
I got my IntelliJ working by:
我的 IntelliJ 通过以下方式工作:
file/settings/java compiler; Module-> target bytecode version set to 8,9 or 10.
文件/设置/java 编译器;模块-> 目标字节码版本设置为 8,9 或 10。
file/project structure SDK and language set to 11, 12 or 13
文件/项目结构 SDK 和语言设置为 11、12 或 13
no need to add anything into the pom.xml file
无需在 pom.xml 文件中添加任何内容
回答by KNayak430
What worked for me was setting the language level to 13.
对我有用的是将语言级别设置为 13。
Go to File --> Project Structure --> Modules
转到文件 --> 项目结构 --> 模块
回答by Santhosh
For a maven project, I got it work, by specifying source and target version for maven-compiler-plugin
对于 Maven 项目,我通过为 maven-compiler-plugin
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>13</source>
<target>13</target>
</configuration>
</plugin>
</plugins>
</build>