Java compiler level does not match the version of the installed Java project facet

301,850

Solution 1

Assuming that you are using the m2e plugin in Eclipse, you'll need to specify the source and target versions as 1.6 for maven-compiler-plugin. m2e uses these values to determine the project's Java compiler level. A snippet of the POM is shown below:

<build>
  <plugins>
    <plugin>
      <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
          <source>1.6</source>
          <target>1.6</target>
        </configuration>
    </plugin>
  </plugins>
</build>

Alternatively, you can specify the maven.compiler.source and maven.compiler.target properties with values of 1.6, that happen to be the equivalent:

<properties>
    <maven.compiler.target>1.6</maven.compiler.target>
    <maven.compiler.source>1.6</maven.compiler.source>
</properties>

Solution 2

If your project is not a Maven project, right-click on your project and choose Properties to open the Project Properties dialog.

There is a Project Facets item on the left, select it, look for the Java facet on the list, choose which version you want to use for the project and apply.

Project Factes - Java version

Solution 3

TK Gospodinov answer is correct even for maven projects. Beware: I do use Maven. The pom was correct and still got this issue. I went to "Project Facets" and actually removed the Java selection which was pointing to 1.6 but my project is using 1.7. On the right in the "Runtimes" tab I had to check the jdk1.7 option. Nothing appeared on the left even after I hit "Apply". The issue went away though which is why I still think this answer is important of the specific "Project Facets" related issue. After you hit OK if you come back to "Project Facets" you will notice Java shows up as version 1.7 so you can now select it to make sure the project is "marked" as a Java project. I also needed to right click on the project and select Maven|Update Project.

Solution 4

I found @bigleftie's comment above very helpful: "Four things must match

  1. Project->Java Build Path->Libraries->JRE version
  2. Project->Java Compiler-> Compiler Compliance Level
  3. Project->Project Facets->Java->Version
  4. (if using Maven) pom.xml - maven-compiler-plugin artefact source and target".

In my case, in the project properties, Java compiler, the JDK compliance was set to use the workspace settings, which were different from the java version for the project. I clicked on 'Configure Workspace Settings', and changed the workspace Compiler compliance level to what I wanted, and the problem was resolved.

Solution 5

I resolved this problem by setting the java version in Project Facet property of the project properties, Right click the project root folder -> Properties, search for Project Facets, and select compatible java version.

For reference -

enter image description here

Share:
301,850

Related videos on Youtube

user974802
Author by

user974802

Updated on September 17, 2020

Comments

  • user974802
    user974802 almost 4 years

    I have created a New Dynamic Project under Eclipse Helios Version, where my JRE Version is set to 1.6. I have added Maven capabilities to the Web Application by clicking on ConfigureConvert to Maven Project.

    After adding this, a build error appeared in the Eclipse Problems view:

    Java compiler level does not match the version of the installed Java project facet.
    Unknown Faceted Project Problem (Java Version Mismatch)
    

    Please tell me how to resolve this error (I want to have my JRE version as 1.6 only).

  • Arye Rosenstein
    Arye Rosenstein over 11 years
    The Project Facet->Java should match whatever you have in the pom.xml for the maven-compiler-plugin artifact source and target.
  • Jerry Tian
    Jerry Tian over 11 years
    The root cause of this problem should be the answer provided by @VineetReynolds
  • rjcarr
    rjcarr over 11 years
    I have this problem, and it sounds like it's a maven issue, but I don't use maven, I don't have a POM file, and I'm not even sure I have the maven plugin. Yet I get this same error; my eclipse is set up to use java 1.7 but the facet page of my project will only let me choose 1.6. What am I doing wrong?
  • ADTC
    ADTC over 9 years
    After doing this, the original Java library was removed from the Build Path and a new library (associated with the Project Facet Java setting) was added to the end of the build path. If this happens, restore the original Java library in the correct position in the Build Path (Note: To do this, you should've made a backup of the .classpath file before attempting the answer.) Then do a clean build (Project > Clean). If X continues to appear in the Project Explorer without any actual errors in Markers, close and re-open the project to make it go away.
  • bigleftie
    bigleftie about 9 years
    Four things must match 1) Project->Java Build Path->Libraries->JRE version 2) Project->Java Compiler-> Compiler Compliance Level 3) Project->Project Facets->Java->Version 4) (if using Maven) pom.xml - maven-compiler-plugin artifact source and target
  • Thiago Pereira
    Thiago Pereira about 9 years
    Can you do it: - Right-click on your project - Click Properties - Click the "Project Facets" option on the left menu - Under Facets section "Java" on the right, change it to "1.6", "1.7" or your version... - Click Ok
  • Vineet Reynolds
    Vineet Reynolds about 9 years
    @ThiagoPereira You lose those changes when you reimport in a different workspace. Learn how m2e works.
  • Soman Dubey
    Soman Dubey over 8 years
    I second @TK Gospodinov answer. my pom was upto date with Java version but project facet was the culprit.
  • Sandoval0992
    Sandoval0992 over 7 years
    Awesome, I've spent too much time trying to fix this problem, now I've finally done it. It's worth mentioning that this worked for me even though mine is a maven project.
  • Mohammad Faisal
    Mohammad Faisal about 7 years
    just removed the project from eclipse and re-imported fixed the issue.
  • 猫IT
    猫IT about 5 years
    Up-voted. This helped me. Clear, right to the point. An Image tells 1000 words they say.
  • Ahmad Nadeem
    Ahmad Nadeem about 5 years
    eclipse users can read journaldev.com/3334/…
  • Mahesha999
    Mahesha999 about 3 years
    I dont know if @bigleftie comment is correct, but it resolved my issues.
  • Tupac
    Tupac over 2 years
    don't see java 1.11 there