24
votes

I am not able to create a new Dynamic Web Project in eclipse indigo. I am getting the following error while creating new one.

Dynamic Web Module 3.0 requires Java 1.6 or newer

I have java compiler version as 1.7 and SDK version 1.7.

enter image description here

16

16 Answers

75
votes

This is late answer. But may help to other. If you are using Maven based project. You just include following code in pom.xml file. It can be resolved.

<build>
    <plugins>
        <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
                <source>1.7</source>
                <target>1.7</target>
            </configuration>
        </plugin>
    </plugins>
</build>

Update: Similarly if you are using jdk version 1.8 just include it in your <source> and <target> tags.

31
votes

Just Change "the dynamic web module version" to 2.5 and than change it back to 3.0 and the error disappears. It worked fine for me.

22
votes

Answer was correct :), But slightly need a correction.

--> Enable Java compiler to 1.7

--> Facet check java (do not check Dynamic module)

--> Last step check Dynamic module

:)...

after you enable java compiler to 1.7 then go to facet then first check java instead of Dynamic module. Then it will allow you to check the Dynamic module.

5
votes

I don't know if this might work for you guys, but here is my case:

  1. My java version lists as java 1.8 with java -version but I got the same same error on eclipse.
  2. Later I changed the dynamic web module version to 2.5. the error notification disappeared.
  3. Then again I changed my dynamic web module version to 3.0 and the error did not show up; and I was able to create the project.

I dont know the reason though.

3
votes

if you are using maven

just add code to pom.xml mentioned by and Project> properties> Maven> Update Project It works

2
votes

my eclipse is pointing to jre version 1.7 , but somehow while creating dynamic web project it is taking java verion 4. i solved it by changing it through configuration>modify>java version to 1.7, in the same panel.

2
votes

Most probably you have several installed java versions on your PC, and your Eclipse is started based on old version.
In command line java -version command shows default one or even first installed one, which is saved somewhere in registers, and it is not always that which is used by your applications. (As example, I have only 1.7 installed physically now but java -version shows old one 1.5)

You may try next: right click on Eclipse shortcut, chose Shortcut tab, and change Target field so that it run with -vm argument pointing on that Java version you need:
"D:\eclipse-jee-kepler-R-win32-x86_64\eclipse\eclipse.exe" -vm "C:\Program Files\Java\jdk1.7.0_45\bin\javaw.exe"

2
votes

i had the same problem, see what i did: first screen Shot: enter image description here

go and click New Runtime>Apache Tomcat v7.0 (for me)>Finish enter image description here

now the error has been removed enter image description here

1
votes

if there is any different JDK version (more then one jdk )installed previously uninstall all of it. then install fresh one jdk (latest ) n to configure java environment see follow this link....

https://www.youtube.com/watch?v=Hl-zzrqQoSE&list=PL484D73FA74A11AC9

now follow following steps:

  1. right click on project >properties >project fact
  2. check on java by selecting version on its right side with dropdownlist.
  3. check on Dynamic Web Module with its version (remember that different version of this requires different version of TomcatServer so installed one step old version of tomcatServer)
  4. now click apply n ok.

There are different reason for this problems but this is the most cases. is not solved contact at [email protected]

1
votes

Go to **Configuration->Modify->java->**select java version 1.6 or later on ..Error will disappear.. thanks.

1
votes

Follow below steps and all errors will be gone -

1- Right-click on your project folder 2- Click properties 3- Click Java Build Path 4- Click Libraries 5- Select JRE system library 6- Click the edit button on the right 7- Select alternate JRE 8- From the drop-down select the installed JRE and all errors will be gone

1
votes

I needed to modify the configuration and create a new runtime for tomcat. Not sure what happened to the original installation, but creating a new one did the trick.

TomcatConfiguration

0
votes

Because Dynamic Web Module 3.0 requires Java 1.6 or newer. (Dynamic Web Module version 3.0 refer Serverlet 3.0)
You should
* Download and install newer JDK (JDK 1.8u20)
* Download and install newer Eclipse: Eclipse IDE for Java EE Developers Luna (4.4) enter image description here

Update:
* Check JAVA_HOME Environment variable
or
* Edit eclipse.ini file (tutorial: http://wiki.eclipse.org/Eclipse.ini ) find section: -vm value

0
votes

This works for me ...

file >> New >> Dynamic web project >> Enter project name >> Change 'Dynamic Web module version' from 3.0 to a lower version ,say 2.5, then change it back to 3.0 , the error message disappears . I think the initial error message that says it requires java 1.6 or above is a bug in Eclipse Java EE.

-1
votes

The following worked for me

  1. Go to .settings File
  2. Then add project Facet "File.org.eclipse.wst.common.project.facet.core"
  3. then add the following file

<?xml version="1.0" encoding="UTF-8"?> -

<fixed facet="jst.java"/>

<fixed facet="jst.web"/>

<installed facet="jst.web" version="3.0"/>

<installed facet="jst.java" version="1.8"/>

<installed facet="jst.web" version="2.4"/>

</faceted-project>

save it and refresh the project 4. then try to add Dynamic web module in project facets.