本文主要是介绍lambda expressions are not supported at language level '5',希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
刚把Eclipse中新建的练习项目导入idea的时候想使用lambda表达式发现一直报如下错误:
lambda expressions are not supported at language level '5'
将项目默认sdk替换成jdk8仍然不起作用,最后发现需要修改Source中的languagelevel为8,找到stackoverflow上一个回答不错,copy如下供大家参考:
I had to do a few things to get rid of this problem.
- File > Project Structure > Project > Project SDK: Change it to Java 1.8.XX
- File > Project Structure > Project > Language Level: SDK 8 (in my case SDK default was already 8)
- File > Project Structure > Modules > Sources > SDK 8 (in my case SDK default was already 8)
- File > Settings > Build, Execution, Deployment > Compiler > Java Compiler > Project bytecode version > 1.8
- File > Settings > Build, Execution, Deployment > Compiler > Java Compiler > Per-module bytecode version > Target bytecode version > 1.8
That should do the trick.
原文地址:https://stackoverflow.com/questions/29921498/lambda-expressions-are-not-supported-at-this-language-level-idea/30102858
这篇关于lambda expressions are not supported at language level '5'的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!