3

Even though I changed my netbeans project's jdk to 1.8, it still gives the following error

lambda expressions not expected here

lambda expressions are not supported in-source 1.7
(use source 8 or higher to enable lambda expressions)

Any help is so much appreciated

Yassin Hajaj
  • 21,337
  • 9
  • 51
  • 89
andy
  • 643
  • 2
  • 12
  • 20

1 Answers1

5

You have to set the project properties for the target version. Java 8 allows you to build for Java 7 execution, and that setting is still there from when you used Java 7. Right-click on the Project in the "Projects" window and select "Properties", then "Sources" in that dialog. On the right you will see "Source/Binary Format". Change that to "1.8", then click "OK".

Lew Bloch
  • 3,364
  • 1
  • 16
  • 10