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

前端 未结 11 1568
无人及你
无人及你 2020-12-09 08:06

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 ecl

相关标签:
11条回答
  • 2020-12-09 08:41

    Two things:

    First, JRE is not the same as the JDK. If you do have the JDK, you need to configure eclipse to point to that in your settings.

    Second, in your screenshot above, your compiler compliance level is set to 1.7. This will treat all your code as if it's using Java 1.7. Change this to 1.8 to fix your error.

    You will need to have Eclipse Luna in order to get support for Java 8, but you can add it to Kepler SR2 if you want. I'd try with Luna and the above suggestions before you go any further. See this reference.

    Once you get Luna, your JAVA_HOME variable should be enough to get Eclipse to recognize JDK 8. If you want to specify an additional JDK, you can add a new Java System Library by going to:

    Project -> Properties -> Java Build Path -> Libraries -> Add Library -> Java System Library
    

    and navigating to a valid location for the JDK 8.

    You can download your platform's JDK 8 here

    0 讨论(0)
  • 2020-12-09 08:41

    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.

    0 讨论(0)
  • 2020-12-09 08:44

    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.

    0 讨论(0)
  • 2020-12-09 08:44

    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.

    0 讨论(0)
  • 2020-12-09 08:49

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

    0 讨论(0)
提交回复
热议问题