By Pankaj Kumar
Recently I imported a Maven project in Eclipse and changed the build path Library to work on Java 1.7. After that Eclipse shown me error in project, although there was no error shown in any files.
The error description was Java compiler level does not match the version of the installed Java project facet.
I also changed the project compiler compliance level to 1.7 but still error was not gone. Below screenshot shows the Problem View where this error was shown.
After some research and looking at the project properties, I was able to fix this issue. All I needed to do was to change the Java Project Facet version from 1.5 to 1.7. Below screenshot shows the Project properties window where you can set the project facets version. Personally I don’t like to change anything in UI, I am more inclined to do things through terminal. Well, there is a way to do this by editing the project settings for facets. You will find this in
org.eclipse.wst.common.project.facet.core.xml
file inside .settings folder at the project root. The original content of this file was:
<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
<fixed facet="wst.jsdt.web"/>
<installed facet="jst.web" version="2.3"/>
<installed facet="wst.jsdt.web" version="1.0"/>
<installed facet="java" version="1.5"/>
</faceted-project>
I modified it to below.
<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
<fixed facet="wst.jsdt.web"/>
<installed facet="jst.web" version="2.3"/>
<installed facet="wst.jsdt.web" version="1.0"/>
<installed facet="java" version="1.7"/>
</faceted-project>
After refreshing the project, error was gone.
If you want to change the compiler compliance level from terminal, you need to edit below properties in org.eclipse.jdt.core.prefs
file.
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.source=1.7
We can change the Library also in .classpath
file of the project, but that is not easy and it depends on the name configured for the Library, for example in my project classpath file, entry for JRE looks like below.
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.launching.macosx.MacOSXType/Home">
<attributes>
<attribute name="owner.project.facets" value="java"/>
</attributes>
</classpathentry>
I hope it will help someone facing this issue with project facets.
Thanks for learning with the DigitalOcean Community. Check out our offerings for compute, storage, networking, and managed databases.
Java and Python Developer for 20+ years, Open Source Enthusiast, Founder of https://www.askpython.com/, https://www.linuxfordevices.com/, and JournalDev.com (acquired by DigitalOcean). Passionate about writing technical articles and sharing knowledge with others. Love Java, Python, Unix and related technologies. Follow my X @PankajWebDev
…More than one year later… Thanks a lot! Your bonus tip helped me to solve the problem!
- Franco
can you plz help me. This solution does not work for me. I follow your instruction but in my project, the applied changes don’t make when I reopen the project facets its same as before. Facing same Error: Java compiler level does not match the version of the installed Java project facet. redmine-client Unknown Faceted Project Problem (Java Version Mismatch)
- aniketa
thank you so much. i was able to resolve my issue, thanks to your article.
- Srikumar K
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.