1

when i package my code, i get this error Error:(13,48) java: lambda expressions are not supported in -source 6.

I tried installing different JDK, but doesnt change. I tried jdk 11, 1.8, 13.

3
  • If you see the same error after you install a newer JDK, then you aren't using the compiler from the newer one. To figure out why, what OS are you using? Commented Mar 20, 2020 at 15:30
  • Im using windows 10 Commented Mar 20, 2020 at 15:31
  • How are you building your package? And can you show example code, including a pom file. I suggest just creating a small project that you can use for troubleshooting. Commented Mar 20, 2020 at 15:34

1 Answer 1

5

You need to specify in the pom the java version your project uses. Add this section to your pom.xml to specify java 8 for instance

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>8</source>
                    <target>8</target>
                </configuration>
            </plugin>
        </plugins>
    </build>
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.