0

I am new to maven and I am trying to compile a lambda expression. When I run mvn install I get this error:

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

I am using SDK version 1.8 as can be seen in this image:

And the code that causes the compile error is this (the error accures on line 11):

Thanks in advance!

2
  • 1
    In your pom.xml which source version are you setting? Check also your compiler settings. Commented Jul 18, 2020 at 10:13
  • Thank you so much! Apparently I didn't even know that I need to have a source version on the pom.xml file, thanks! It fixed the problem Commented Jul 18, 2020 at 10:49

1 Answer 1

1

As stated in the comments, you need to set the source and target levels in you POM.

These can be smaller than the actual JDK you use.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.