lambda expressions are not supported at this language level

时间:2022-11-04 19:27:28

IDEA下报错:lambda expressions are not supported at this language level

解决:

1. File -> Project Structure -> Project -> Project Language Level 选择“8 Lamdas Type Annotations etc”

2. 如果没有改选项请先安装和配置JDK1.8

3. 如果为Maven项目,请将pom.xml中maven-compiler-plugin中<configuration>中的<source>和<target>配置为1.8

介绍Java SE 8提供的Lambda语法的较好文章:

http://zh.lucida.me/blog/java-8-lambdas-insideout-language-features/

http://lucida.me/blog/java-8-lambdas-insideout-library-features/