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 an error message like Dynamic Web Module 3.1 requires Java 1.7 or newer. This article will 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 the Properties menu item in the popup menu.
  3. Then select Java Build Path in the Project Properties window left panel.
  4. Select Libraries —>JRE System Library tab in the right panel.
  5. Click the Edit button.
  6. Select the correct JRE version from the drop-down list. Click the Finish button.

2. Change Eclipse Project Java Compiler JDK Version.

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

3. Change Java Version In Project Facets.

  1. Open eclipse project properties dialog.
  2. Click the Project Facets menu item in the left panel.
  3. Change the Java version in the 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.

  1. If you use maven for your java project, you can add the maven-compiler-plugin in the pom.xml file follow in the below steps.
  2. Right-click the pom.xml file.
  3. Click Maven —>Add Plugin menu item to open the Add Plugin window.
  4. Input maven-compiler in the Enter groupId, artifactId or sha1 prefix or pattern (*) input text box. Then select the org.apache.maven.plugins aven-compiler-plugin in the Search Results list. Click the OK button.
  5. 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.

  1. If the error still exists after the above steps, you can update the java maven project with the following steps.
  2. Right-click the eclipse java project.
  3. Click Maven —> Update Project menu item to update.

Leave a Comment

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.