Tutorial

[Fixed] Eclipse - Java compiler level does not match the version of the installed Java project facet

Published on August 4, 2022
author

Pankaj

[Fixed] Eclipse - Java compiler level does not match the version of the installed Java project facet

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.

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

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. Java compiler level does not match the version of the installed Java project facet

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

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. Eclipse Project Facets Settings to fix Java compiler level does not match the version of the installed Java project facet 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.

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

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.

Learn more about our products

About the authors
Default avatar
Pankaj

author

While we believe that this content benefits our community, we have not yet thoroughly reviewed it. If you have any suggestions for improvements, please let us know by clicking the “report an issue“ button at the bottom of the tutorial.

Still looking for an answer?

Ask a questionSearch for more help

Was this helpful?
 
JournalDev
DigitalOcean Employee
DigitalOcean Employee badge
September 4, 2020

Thank you so much. I spent more than 1 month to research to resolve this issue. You are so talented.

- Thuy

    JournalDev
    DigitalOcean Employee
    DigitalOcean Employee badge
    December 22, 2019

    Uff its works :)Thanks :)

    - Tomasz

      JournalDev
      DigitalOcean Employee
      DigitalOcean Employee badge
      September 26, 2019

      Thanks. It works.

      - Steve Kang

        JournalDev
        DigitalOcean Employee
        DigitalOcean Employee badge
        September 25, 2019

        Thanks a lot. the solution worked for me.

        - ilh

          JournalDev
          DigitalOcean Employee
          DigitalOcean Employee badge
          March 8, 2019

          Thanks a lot!! It works!!

          - Ahamed Shameem

            JournalDev
            DigitalOcean Employee
            DigitalOcean Employee badge
            March 7, 2019

            thank you so much. i was able to resolve my issue, thanks to your article.

            - Srikumar K

              JournalDev
              DigitalOcean Employee
              DigitalOcean Employee badge
              March 6, 2019

              Thanks a lot … It worked for me

              - Ranjitha

                JournalDev
                DigitalOcean Employee
                DigitalOcean Employee badge
                January 28, 2019

                thanks a lot

                - ankit

                  JournalDev
                  DigitalOcean Employee
                  DigitalOcean Employee badge
                  August 15, 2018

                  Thanks a lot your solution worked for me too!

                  - Bulelani Mlindelwa

                    JournalDev
                    DigitalOcean Employee
                    DigitalOcean Employee badge
                    February 9, 2018

                    Thanks a lot. Solution worked for me.

                    - Shashank Dahake

                      Try DigitalOcean for free

                      Click below to sign up and get $200 of credit to try our products over 60 days!

                      Sign up

                      Join the Tech Talk
                      Success! Thank you! Please check your email for further details.

                      Please complete your information!

                      Become a contributor for community

                      Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

                      DigitalOcean Documentation

                      Full documentation for every DigitalOcean product.

                      Resources for startups and SMBs

                      The Wave has everything you need to know about building a business, from raising funding to marketing your product.

                      Get our newsletter

                      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

                      The developer cloud

                      Scale up as you grow — whether you're running one virtual machine or ten thousand.

                      Get started for free

                      Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

                      *This promotional offer applies to new accounts only.