1

Installed java version is 1.8, while selecting this version in pom.xml and updating the maven project,it automatically jumps from 1.8 to 1.4, due to which I am unable to have Lambda expression specific code.

I am using eclipse kepler.

Any idea what is happening here ?

Pankaj Sharma
  • 95
  • 1
  • 10
  • Do any of your Maven build files (e.g. `pom.xml`) specify the Java compiler version anywhere? – nanofarad Jun 17 '15 at 21:05
  • This might help: http://stackoverflow.com/questions/30849697/why-does-eclipse-reference-a-1-4-jre#comment49743826_30849697 Have you installed the Kepler plug-in which allows it to use Java 8? (It does not natively support Java 8.) – River Jun 17 '15 at 21:17
  • can you post the relevant sections of your pom.xml? do you have java8 listed under the known VMs in the eclipse configuration? worksforme with eclipse mars and m2e 1.6.0.20150506-1605 – the8472 Jun 17 '15 at 21:18
  • Did you install the Java 8 support for Kepler? It doesn’t come automatically. – Holger Jun 18 '15 at 08:21

2 Answers2

0

Add something similar to this to your pom. You might have to tweak the plug in version.

<project> 
[...] 
    <build> 
    [...] 
        <plugins> 
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.3</version>
                <configuration> 
                    <source>1.8</source> 
                    <target>1.8</target>
                </configuration> 
            </plugin>
         </plugins> 
         [...] 
     </build>
 [...] 
</project>

Apologies I'm on mobile and the editor sucks for code formatting.

Edit: As noted in the accepted answer you also need to enable Java 8 support in Kepler.

mez.pahlan
  • 1,053
  • 2
  • 11
  • 25
  • I have already did the same thing,but while updating jre shifts to 1.4,but when I set Source, target 1.7 then on updating maven project it works fine. – Pankaj Sharma Jun 17 '15 at 21:41
-1

With the help of Hogler's comment above I am able to reswolve this issue

Just did this :

https://wiki.eclipse.org/JDT/Eclipse_Java_8_Support_For_Kepler

Pankaj Sharma
  • 95
  • 1
  • 10