Eclipse Troubleshooting: Adjusting Java Project Facet Version

Problem Statement

After importing a Maven project into Eclipse and changing the build path to Java 1.7, an error message appeared in the project, although no file showed an error. The error description read: “Java compiler level does not match the version of the installed Java project facet”. Despite changing the compiler compliance level to 1.7, the error persisted.

Solution Approach

The solution to the problem was simpler than expected. I just had to change the Java project facet version from 1.5 to 1.7. This can be done either through the project properties in the Eclipse UI or by directly editing the project settings.

Changing via Eclipse UI:

  1. Open the project properties.
  2. Change the version of the Java project facet to 1.7.

Changing via the configuration file:

  1. Open the file org.eclipse.wst.common.project.facet.core.xml in the .settings folder of the project.
  2. Change the entry for the Java facet from 1.5 to 1.7.

Additional Tip: Changing the Compiler Compliance Level via Terminal

If you, like me, prefer to make settings via the terminal, you can change the compiler compliance level by editing the file org.eclipse.jdt.core.prefs:

  • 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

Conclusion

Through these simple steps, I was able to quickly and efficiently solve the problem with the Java compiler level in Eclipse. This method is particularly useful if you prefer to make settings not through the user interface, but directly through configuration files or the terminal. I hope this post can help other developers who encounter similar problems.

Create a Free Account

Register now and get access to our Cloud Services.

Posts you might be interested in: