[java] Why won't eclipse switch the compiler to Java 8?

I checked out a Java project from SVN in eclipse and realized that it requires Java 8 because it uses lambdas etc. I installed the eclipse addon for Java 8 and restarted eclipse and and have the project set up like so:

New Java Project

I noticed that near the bottom, it says that the default compiler compliance is 1.7, so I went into org.eclipse.jdt.core.prefs and set the compiler compliance variable to 1.8, as per this answer. However, in Project -> Preferences -> Java Compiler, it still shows up as:

eclipse please

I have set the JRE in Project -> Java Build Path:

jre8

Yet the compiler refuses to compile lambda expressions - I get an error that looks like what I would get if I went ahead and typed it into Java 7.

This is the version of eclipse I'm using

Version: Kepler Service Release 1
Build id: 20130919-0819

Is the only way to solve this to install a fresh version of Eclipse or am I missing something in the configuration?

This question is related to java eclipse

The answer is


<build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.6.1</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
        </plugins>
    </build>

First install the JDK1.8 set to Path Open Eclipse and Oper Eclipse Market Place option. Search for jdk 1.8 for kepler Install the required plugin. Restart the eclipse. Change compiler level to 1.8 from preferences. If still there is an error then click on the file and change the compiler setting explicitly to Jdk 1.8


Assuming you have already downloaded Jdk 1.8. You have to make sure your eclipse version supports Jdk 1.8. Click on "Help" tab and then select "Check for Updates". Try again.


This is a old topic but I just wanted to point out that I have searched enough to find that Indigo version can't be updated to S.E 1.8 here the link which is given on eclipse website to update the Execution Environment but if you try it will throw error for Indigo.

Image//wiki.eclipse.org/File:ExecutionEnvironmentDescriptionInstallation.png this is the link where the Information about execution environment is given.

https://wiki.eclipse.org/JDT/Eclipse_Java_8_Support_For_Kepler This shows the step by step to update Execution environment.

I have tried to update Execution environment and I got the same error.


I had the similar problem with eclipse kepler.I have followed these steps to resolve it

  • Go to Help in Eclipse and Oper Eclipse Market Place option.
  • Search for jdk 1.8 for kepler
  • Install the required plugin.
  • Restart the eclipse.

for reference, refer this link http://techno-terminal.blogspot.in/2016/05/jdk-18-compiler-compliance-is-not.html


You must install the JDT/Eclipse Java 8 Support For Kepler. https://wiki.eclipse.org/JDT/Eclipse_Java_8_Support_For_Kepler


Old question, but posting the answer incase it helps someone. Already build path was configured to use JDK 1.2.81 However, build was failing with the error below:

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

In the latest Eclipse (Photon), adding the below entry to pom.xml worked.

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <maven.compiler.target>1.8</maven.compiler.target>
    <maven.compiler.source>1.8</maven.compiler.source>
  </properties>

It cause eclipse kepler SR1 does not support new Java™ 8 language enhancements like lambda expression.

From information here: http://www.eclipse.org/downloads/java8/
I think you should use kepler SR2 with support plugin, or change to Eclipse Luna.


Updated link 16/09/2016: https://wiki.eclipse.org/JDT/Eclipse_Java_8_Support_For_Kepler


I had the same problem even though I had:

  • a freshly downloaded JDK 1.8.0

  • JAVA_HOME is set

  • java -version on command line reports 1.8

  • Java in control panel is set to 1.8

  • downloaded Eclipse Mars

Eclipse only let me choose a compiler compliance level op to 1.7 in the compiler preferences, even though my installed JRE is 1.8.0. I also couldn't see a 1.8 in the Execution Environments underneath Installed JREs, only a JavaSE-1.7 (which I haven't even got installed!). When I clicked on that, it shows "jdk1.8.0" as a compatible JRE, so I selected that, but still no change.

Then I unzipped Eclipse Mars into a brand new directory, created a new project, and now I can select 1.8, hurrah! That greatly reduced the "Duplicate methods named spliterator..." errors I was getting when compiling my code under Java 1.8, however, there is still one left:

Duplicate default methods named spliterator with the parameters () and () are inherited from the types List and Set.

However, that's likely because I'm extending AbstractList and implementing Set, so I've fixed that for now by removing the implements Set because it doesn't really add anything in my case (other than signifying that my collection has only unique elements)


First of all you should get JdK 8.

if you have Jdk installed.

you should set its path using cmd prompt or system variables.

sometimes it can happen that the path is not set due to which eclipse is unable to get the properties for jdk.

Installing latest ecipse luna can solve your problem.

i have indigo and luna. i can set 1.8 in luna but 1.7 in indigo.Eclipse luna

You can check the eclipse site. it says that the eclipse luna was certainly to associate the properties for jdk 8.