0

C:\Users\SAYAN\Desktop\block-ch\project\khs-blockchain-java-example-master\src\main\java\simple\chain\Block.java:[51,29] error: lambda expressions are not supported in -source 1.5

I have installed jdk 1.8. Still I am getting this error. Need help!!!

Sayan
  • 47
  • 12
  • 5
    Possible duplicate of [What causes imported Maven project in Eclipse to use Java 1.5 instead of Java 1.6 by default and how can I ensure it doesn't?](https://stackoverflow.com/questions/3539139/what-causes-imported-maven-project-in-eclipse-to-use-java-1-5-instead-of-java-1) – Rcordoval Jun 13 '18 at 01:35
  • share the code `Block.java` – TheSprinter Jun 13 '18 at 05:45

2 Answers2

1

I made it. This will work.

In the pom.xml we need to add
<build>
   <plugins> 
    <plugin> 
    <groupId>org.apache.maven.plugins</groupId> 
    <artifactId>maven-compiler-plugin</artifactId> 
    <version>3.2</version> 
    <configuration> 
    <source>1.8</source> 
    <target>1.8</target>
   </configuration> 
   </plugin> 
  </plugins>
</build>
MWiesner
  • 8,868
  • 11
  • 36
  • 70
Sayan
  • 47
  • 12
0

Or use below in your pom.xml

  <java.version>1.8</java.version>

  <maven.compiler.target>1.8</maven.compiler.target>

  <maven.compiler.source>1.8</maven.compiler.source>

sandejai
  • 931
  • 1
  • 15
  • 22