6

I am trying to follow the spark java tutorial. I set up all things, and tried compiling the project. I got the following error:

Error:(8, 34) java: lambda expressions are not supported in -source 1.5
  (use -source 8 or higher to enable lambda expressions)

I then tried setting the compiler options and the default JDK, but I am still seeing that error.

Here is how I set my IDE:

enter image description here

I would be happy if you could help me.

oz123
  • 27,559
  • 27
  • 125
  • 187

2 Answers2

14

It's not enough to set the project level. You need to set up the Module level.

Follow these steps.

Right Click on the project------>> go to Open module Settings--->
In that opening window click the Project in project settings---->
and set project SDK

See this answer https://stackoverflow.com/a/21747364/492620

Community
  • 1
  • 1
oz123
  • 27,559
  • 27
  • 125
  • 187
7

Select project and press alt+ctrl+shift+s and you get Project Structure window where you need to set project sdk and language level for project. enter image description here

Then you should be able to use lambdas.

akhil_mittal
  • 23,309
  • 7
  • 96
  • 95