错误:java:无效的源发行版:Intellij中的8。 这是什么意思?
本文翻译自:Error:java: invalid source release: 8 in Intellij. What does it mean?
Im trying to compile some code in I'm using Intellij Ultimate 13.1.4, but I get the following error and I have no idea what it means: 我正在尝试使用Intellij Ultimate 13.1.4编译一些代码,但是出现以下错误,我不知道这意味着什么:
Information:Using javac 1.7.0_55 to compile java sources
Information:java: Errors occurred while compiling module 'Example'
Information:Compilation completed with 1 error and 0 warnings in 3 sec
Information:1 error
Information:0 warnings
Error:java: invalid source release: 8
My guess is that its something related to Java 8 vs Java 7, but I have no idea what specifically. 我的猜测是它与Java 8 vs Java 7有关,但是我不知道具体是什么。 I've tried to Google around for this message, but they either talk about javac
or target release
, so it doesn't exactly seem to apply. 我已尝试在Google周围搜索此消息,但他们要么谈论javac
要么target release
,所以它似乎并不适用。
#1楼
参考:https://stackoom.com/question/1KA3P/错误-java-无效的源发行版-Intellij中的-这是什么意思
#2楼
I had the same issue when "downgrading" a project from Java 8 to Java 6. The reason was that it was not changed at all places in IntelliJ. 将项目从Java 8“降级”到Java 6时,我遇到了相同的问题。原因是在IntelliJ中并未在所有地方都对其进行更改。
In IntelliJ 13.1.4 I had to change Java and SDK version on the following places not to get this error: 在IntelliJ 13.1.4中,我不得不在以下位置更改Java和SDK版本,以免出现此错误:
- File -> Project Structure -> Project Settings 文件->项目结构->项目设置
- File -> Project Structure -> Module Settings -> Tab: Sources: Language Level 文件->项目结构->模块设置->选项卡:源:语言级别
- File -> Project Structure -> Module Settings -> Tab: Dependencies: Module SDK 文件->项目结构->模块设置->选项卡:依赖项:模块SDK
- File -> Settings -> Compiler -> Java Compiler -> Target bytecode version 文件->设置->编译器-> Java编译器->目标字节码版本
The last bullet was the one that was not updated in my case. 最后一个项目符号是我的情况下未更新的项目符号。 Once I changed this, the error disappeared. 更改此设置后,错误消失了。
#3楼
Check your pom.xml
first (if you have one) 首先检查您的pom.xml
(如果有的话)
Check your module's JDK
dependancy. 检查模块的JDK
依赖性。 Make sure that it is 1.8
确保它是1.8
To do this,go to Project Structure -> SDK's 为此,请转到项目结构-> SDK
Add the path to where you have stored 1.8 ( jdk1.8.0_45.jdk
in my case) 将路径添加到存储1.8的位置 (在我的情况下为jdk1.8.0_45.jdk
)
Apply the changes 套用变更
Now, go to Project Structure ->Modules 现在,转到项目结构->模块
Change the Module SDK to 1.8
将Module SDK更改为1.8
Apply the changes 套用变更
Voila! 瞧! You're done 你完成了
#4楼
If you are using Gradle as a build tool and you get this error when executing a Gradle task ie TomcatRun take a look to my other answer to the same question 如果您使用Gradle作为构建工具,并且在执行Gradle任务(例如TomcatRun)时收到此错误,请查看我对相同问题的其他答案
javac: invalid target release: 1.8 javac:无效的目标版本:1.8
#5楼
Andreas Lundgren's answer worked and I was able to compile and run my app. Andreas Lundgren的答案奏效了,我得以编译并运行我的应用程序。
However, when I tried to run the project's associated JUnit tests I received the same error. 但是,当我尝试运行项目的关联JUnit测试时,我收到了相同的错误。 Running 运行
gradle -version
from Windows command prompt showed that gradle was still picking up the incorrect jdk. 从Windows命令提示符显示gradle仍在拾取错误的jdk。 To fix it I had to set the JAVA_HOME
environment variable to point to the correct jdk and restart IntelliJ. 要修复它,我必须将JAVA_HOME
环境变量设置为指向正确的jdk并重新启动IntelliJ。
#6楼
Change in pom.xml
1.6
to 1.8
将pom.xml
1.6
更改为1.8
<plugin><artifactId>maven-compiler-plugin</artifactId><configuration><source>1.8</source><target>1.8</target></configuration>
</plugin>
错误:java:无效的源发行版:Intellij中的8。 这是什么意思?相关推荐
- java: 无效的源发行版: 15
java: 无效的源发行版: 15 问题 项目编译出现如下错误 java: 无效的源发行版: 15 解决方案 1 打开项目结构 2 更改项目sdk为所需版本, 即JDK15 2 更改模板sdk为所需版 ...
- Intellij idea 出现错误 error:java: 无效的源发行版: 8解决方法
Intellij idea 出现错误 error:java: 无效的源发行版: 8解决方法 参考文章: (1)Intellij idea 出现错误 error:java: 无效的源发行版: 8解决方法 ...
- java: 错误:无效的源发行版:14
IDEA:java: 错误:无效的源发行版:14 在Java项目运行中出现下列报错 导致这个原因出现是因为当前项目的JDK版本与电脑配置的JDK环境版本不一样导致的 1.首先使用win + r打开cm ...
- java无效的源发行版_无效的Java
java无效的源发行版 也许我可以被机器人代替进行代码审查. 有一些反馈我发现自己一遍又一遍. 这是我最不喜欢的一些: 通用代码结构 放弃其他 当if在两端return的else是多余的和不必要的创建 ...
- 问题|Error:java: 无效的源发行版: 10 @Java
目录 问题描述 原因分析 解决方法 问题描述 背景: 工具:IntelliJ IDEA工具 背景:今日在IDEA的导入普通的java项目模块后,运行java程序时,发现项目中每一个程序都在编译时报错 ...
- Error:java: 无效的源发行版: 11
Error:java: 无效的源发行版: 11 1.问题描述 2.原因查找 3.解决办法 3.1 打开IDEA的File-Project Structure设置 3.2 修改Project SDK为自 ...
- error:java:无效的源发行版_IDEA java出现无效的源发行版14解决方案_java
这篇文章主要介绍了IDEA java出现无效的源发行版14解决方案,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友可以参考下 问题描述 问题原因 出现该问题的原 ...
- Intellij idea 出现错误 error:java: 无效的源发行版: 11解决方法
Select the project, then File > ProjectStructure > ProjectSettings > Modules -> sources ...
- 解决:Intellij idea 启动项目报错 error:java: 无效的源发行版: 8
前些天发现了一个巨牛的人工智能学习网站,通俗易懂,风趣幽默,忍不住分享一下给大家.点击跳转到教程. 1.我的情况: 我自已电脑环境变量配置的 JDK8 ,后来公司项目沿用 JDK7,我就换回了 7 . ...
- IDEA:java:无效的源发行版:14
目录 问题描述 问题原因 解决方法 问题描述: 用IDEA编写代码运行后报如下错误: 问题原因: 出现该问题的原因是项目Project当中的jdk与电脑当中的jdk版本不一致造成的. 解决方法: 1. ...
最新文章
- javascrit2.0完全参考手册(第二版) 第1章第1节 在XHTML文档中增加javascript
- 【MM模块】 Info Record 采购信息记录
- 判断用户是否存在再进行新增_MySQL用户行为分析
- python123第一周测试作业指导书_风速仪作业指导书.doc
- java 在面板中加入标签_创建一个JTabbedPane面板,为每一个标签设置一个名称
- 后台业务管理系统原型模板/在线教育后台管理系统/客服系统/财务管理/用户管理/订单管理/教育业务后台管理/课程管理/教师管理/活动管理/文章管理/Axure高保真在线教育行业原型/Axure后台管理
- java day of month_Java LocalDateTime getDayOfMonth()用法及代码示例
- 153. Find Minimum in Rotated Sorted Array找其中的最小值
- RabbitMQ 集群原理和完善
- 利用模板类型实现累加
- 记一次PSP游戏文件(iso)提取BGM(cpk文件处理,无后缀音频文件格式转换,pmf文件转换)
- 免费下载百度文库文档、免注册、免登录、免财富值 - 帮手网-云下载
- 系统分析和设计方法之系统分析
- Mac OX 下方便的微信语音,图片,视频等导出方式
- Micro LED - OLED注定过渡
- 利用cftool进行函数拟合
- NFC无线充电(WLC)介绍
- 特斯拉电池细节_一家超级秘密的电池初创公司暗示其吹过特斯拉,但不会展示商品...
- Windows update
- 国内外教育机器人生产企业及产品情况分析
热门文章
- CDISC的ADaMIG (V1.2) 中英文对照【2】_第二章 ADaM标准的基础
- 【热门主题:喵星人高清桌面壁纸】
- python内存清理_python如何清理内存
- 【用AI打击犯罪】高质量实际监控视频异常检测(免费下载:抢劫,行窃,偷窃,射击,袭击,打架,纵火,爆炸,逮捕,车祸等)
- 被误传了数千年的四大成语 相濡以沫 女子与小人难养也 无度不丈夫 以德抱怨
- ZeroTier-One配置moon心得
- matlab 对称天线动态图,关于Matlab的对称振子天线分析.pdf
- iOS真机调试步骤(Xcode8.0以上版本)(2015年)
- 面向对象编程和面向接口编程的区别
- 一个电脑板绘初学者的自述,设计基础