Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using NetBeans 8 but getting below compilation error for Lambda expression

I am using NetBeans 8. When my code contains a Lambda expression and I try to compile, I get the following error message:

lambda expression not expected here

lambda expressions are not supported in -source 1.5
  (use -source 8 or higher to enable lambda expressions)
----
(Alt-Enter shows hints)
like image 767
Pushkar Avatar asked Mar 27 '14 11:03

Pushkar


3 Answers

Please click right from you project -> Properties -> Choose Sources -> (you will see Source/Binary Format) change it to 1.8 -> Click OK.

Or you can see in this link http://tinadev.blogspot.com/2015/08/lambda-expression-not-expected-here.html

Thanks

For NetBeans IDE 8.2, JDK 8

like image 198
Tien Nguyen Avatar answered Nov 12 '22 06:11

Tien Nguyen


Change compiler version of your source code into your project properties to jdk 8 and firstly check whether you have installed one.

like image 40
RMachnik Avatar answered Nov 12 '22 06:11

RMachnik


In the project properties dialog, select Sources in the left panel and then on the bottom right look for "Source/Binary Format" Change that to JDK 8.

like image 4
Richard Bailey Avatar answered Nov 12 '22 05:11

Richard Bailey