1
votes

I'm using IntelliJ Idea and I get this error.

Lamba expressions are not supported in -source 1.6

Got this when I updated from 2016 to the 2017 version of the community edition after I did something with gradle.

Settings: Java compiler: Project bytecode version: 1.8 Modules bytecode version: 1.8 Project SDK: 1.8 Project language level: default(8) Modules 1.8 as well

2
You probably switched your java version to 1.6 by accident. Try updating java to 1.8 in order to have access to lambda function api's.John Gallagher
I only have java 8 installed, both SDK and JRE 8 version 144jordibenck
Check your java version with java -version command. If by some reason you have 1.6 version then uninstall it or set JAVA_HOME environment variable to jre_1.8.X/bin directory.Aleksei Budiak
Check your IDE settings, you may have it (or gradle) to Java 1.6Elliott Frisch

2 Answers

1
votes

Check Settings -> Compiler - > Java Compiler. If that doesn't work, for MAVEN: you can set it in your pom.xml, like this:

<properties>
  <maven.compiler.source>1.7</maven.compiler.source>
  <maven.compiler.target>1.7</maven.compiler.target>
</properties>

for gradle :

sourceCompatibility = "1.8"; 
targetCompatibility = "1.8"; // defaults to sourceCompatibility
1
votes

that because in you IDEA the Project language level set to "6 - @Override in interface"

to solve goto:

File -> Other Setting -> Default Project Structure

now change Project language level to Lambdas , type annotation etc. and then click OK