Reputation: 3457
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).
Upvotes: 240
Views: 347348
Reputation: 449
I found @bigleftie's comment above very helpful: "Four things must match
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.
Upvotes: 15
Reputation: 8452
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.
Upvotes: 462
Reputation: 4417
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 -
Upvotes: 8
Reputation: 21
In Eclipse, right click on your project, go to Maven> Update projetc. Wait and the error will disappear. This is already configured correctly the version of Java for this project.
Upvotes: 2
Reputation: 2856
If using eclipse,
Under.settings click on org.eclipse.wst.common.project.facet.core.xml
<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
<installed facet="java" version="1.7"/>
</faceted-project>
Change the version to the correct version.
Upvotes: 1
Reputation: 564
You can change project facet from Project --> Properties --> Project Facet --> Java --> {required JDK version}
Upvotes: 4
Reputation: 2272
I resolved it by Myproject--->java Resource---->libraries-->JRE System Libraries[java-1.6] click on this go to its "property" select "Classpath Container" change the Execution Environment to java-1.8(jdk1.8.0-35) (that is latest)
Upvotes: 6
Reputation: 173
I changed the configuration inside workspace/project/.setting/org.eclipse.wst.common.project.facet.core
to :
installed facet="jst.web" version="2.5"
installed facet="jst.java" version="1.7"
Before changing config, remove project from IDE. This worked for me.
Upvotes: 5
Reputation: 41
The Project Facet->Java should match whatever you have in the pom.xml for the maven-compiler-plugin artifact source and target.This is perfect.But if you donot have it here then you can also fix it by matching Java compiler version in Porject-Facets from the setting: Eclispe->Preferences->Java->Compiler
Upvotes: 4
Reputation: 1812
Right click the project and select properties Click the java compiler from the left and change to your required version Hope this helps
Upvotes: 3
Reputation: 3027
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.
Upvotes: 19
Reputation: 76709
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>
Upvotes: 176