Eclipse Dynamic Web Module 3.1 requires Java 1.7 or newer Error Resolve Method

When you create a dynamic web project ( such as spring mvc using sts ), you may encounter error message like Dynamic Web Module 3.1 requires Java 1.7 or newer. This article will just tell you how to fix it.

Dynamic Web Module 3.1 requires Java 1.7 or newer Error message

1.  Change Eclipse Java Build Path JRE Library Version To 1.7 Or Higher.

  1. Right click the eclipse java project.
  2. Click Properties menu item in the popup menu.
  3. Then select Java Build Path in left panel list.
  4. Select Libraries —>JRE System Library tab in right panel.
  5. Click Edit button.
  6. Select the correct JRE version from the drop down list. Click Finish button.
    change jre system library version in eclipse java build path

2. Change Eclipse Project Java Complier JDK Version.

  1. Open the eclipse project properties dialog.
  2. Click Java Compiler menu item in left panel, then check Enable project specific settings checkbox in right panel and select correct Compiler compliance level in the drop down list.
    change eclipse java project java compiler version level

3. Change Java Version In Project Facets.

  1. Open eclipse project properties dialog.
  2. Click Project Facets menu item in left panel.
  3. Change the Java version in right panel. And above the Java project facet is the Dynamic Web Module project facet, you can change the related version there.
    change java version in eclipse project facets

4. Add Maven Compiler Plugin In Pom.xml File.

If you use maven for your java project, you can add maven-compiler-plugin in pom.xml follow below steps.

  1. Right click the pom.xml file.
  2. Click Maven —>Add Plugin menu item.
    add maven plugin in pom xml file
  3. Input maven-compiler-plugin in the Enter groupId, artifactId or sha1 prefix or pattern (*) input box. Then select the maven-compiler-plugin in the Search Results list. Click OK.
    input maven compiler plugin in the search box
  4. Below xml source code will be added in the pom.xml file.
    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.7.0</version>
        <configuration>
            <source>1.8</source>
            <target>1.8</target>
        </configuration>
    </plugin>

5. Update Maven Project.

If the error still exist after above steps, you can update the java maven project with following steps.

  1. Right click the eclipse java project.
  2. Click Maven —> Update Project menu item to update.
    sts click porject name maven update project menu
(Visited 25 times, 1 visits today)
READ :   Convert String Object To Character Array

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.