Java compiler level does not match the version of the installed Java project facet
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.
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
- Project->Java Build Path->Libraries->JRE version
- Project->Java Compiler-> Compiler Compliance Level
- Project->Project Facets->Java->Version
- (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 -
Related videos on Youtube
user974802
Updated on September 17, 2020Comments
-
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 Configure → Convert 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).
-
Jack Mason over 5 yearsBigleftie's answer served me well for a non Maven project.
-
Ahmad Nadeem about 5 yearseclipse users can read this journaldev.com/3334/…
-
BuZZ-dEE almost 5 yearsPossible duplicate of "Faceted Project Problem (Java Version Mismatch)" error message
-
-
Arye Rosenstein over 11 yearsThe Project Facet->Java should match whatever you have in the pom.xml for the maven-compiler-plugin artifact source and target.
-
Jerry Tian over 11 yearsThe root cause of this problem should be the answer provided by @VineetReynolds
-
rjcarr over 11 yearsI 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 over 9 yearsAfter 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). IfX
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 about 9 yearsFour 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 about 9 yearsCan 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 about 9 years@ThiagoPereira You lose those changes when you reimport in a different workspace. Learn how m2e works.
-
Soman Dubey over 8 yearsI second @TK Gospodinov answer. my pom was upto date with Java version but project facet was the culprit.
-
Sandoval0992 over 7 yearsAwesome, 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 about 7 yearsjust removed the project from eclipse and re-imported fixed the issue.
-
猫IT about 5 yearsUp-voted. This helped me. Clear, right to the point. An Image tells 1000 words they say.
-
Ahmad Nadeem about 5 yearseclipse users can read journaldev.com/3334/…
-
Mahesha999 about 3 yearsI dont know if @bigleftie comment is correct, but it resolved my issues.
-
Tupac over 2 yearsdon't see java 1.11 there