Java "lambda expressions not supported at this language level"

Czipperz picture Czipperz · Mar 28, 2014 · Viewed 177.7k times · Source

I was testing out some new features of Java 8 and copied the example into my IDE (Eclipse originally, then IntelliJ) as shown here

Eclipse offered no support whatsoever for lambda expressions, and IntelliJ kept reporting an error

Lambda expressions not supported at this language level

I would like to know if this is a problem with my install, the code, or support.

Answer

Abhilash Divakaran picture Abhilash Divakaran · Mar 28, 2014

In IntelliJ IDEA:

In File MenuProject StructureProject, change Project Language Level to 8.0 - Lambdas, type annotations etc.

For Android 3.0+ Go FileProject StructureModuleapp and In Properties Tab set Source Compatibility and Target Compatibility to 1.8 (Java 8)

Screenshot:

enter image description here