Eclipse-Dynamic Web Module 3.0 在创建新项目时需要 Java 1.6 或更高版本错误

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/25909611/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-11 01:27:14  来源:igfitidea点击:

Eclipse- Dynamic Web Module 3.0 requires Java 1.6 or newer error while creating new project

javaeclipseeclipse-plugin

提问by pappu_kutty

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

我无法在 eclipse indigo 中创建新的动态 Web 项目。我在创建新的时收到以下错误。

Dynamic Web Module 3.0 requires Java 1.6 or newer

动态 Web 模块 3.0 需要 Java 1.6 或更新版本

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

我的 java 编译器版本为 1.7,SDK 版本为 1.7。

enter image description here

在此处输入图片说明

采纳答案by pappu_kutty

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.

我的 eclipse 指向 jre 版本 1.7 ,但不知何故在创建动态 Web 项目时它采用了 java 版本 4。我通过在同一面板中通过配置>修改>java版本将其更改为 1.7 来解决它。

回答by Do Nhu Vy

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

因为Dynamic Web Module 3.0 需要 Java 1.6 或更新的. (动态 Web 模块版本 3.0 参考 Serverlet 3.0
您应该
* 下载并安装较新的 JDK ( JDK 1.8u20)
* 下载并安装较新的 Eclipse:Eclipse IDE for Java EE Developers Luna (4.4)在此处输入图片说明

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

更新:
* 检查JAVA_HOME环境变量

* 编辑eclipse.ini文件(教程:http: //wiki.eclipse.org/Eclipse.ini)查找部分:-vm value

回答by Mykola Evpak

Most probably you have several installed java versions on your PC, and your Eclipse is started based on old version.
In command line java -versioncommand 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 -versionshows old one 1.5)

很可能您的 PC 上安装了多个 Java 版本,并且您的 Eclipse 是基于旧版本启动的。
在命令行中java -version命令显示默认的一个甚至第一个安装的一个,它保存在寄存器中的某处,并且它并不总是被您的应用程序使用。(例如,我现在只安装了 1.7,但java -version显示旧的 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"

您可以尝试下一步:右键单击Eclipse 快捷方式,选择快捷方式选项卡,然后更改目标字段,使其运行时使用 -vm 参数指向您需要的 Java 版本
“D:\eclipse-jee-kepler-R-win32-x86_64 \eclipse\eclipse.exe" -vm "C:\Program Files\Java\jdk1.7.0_45\bin\javaw.exe"

回答by Barbaros Erdogdu

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 -versionbut 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.
  1. 我的 java 版本列为 java 1.8,java -version但我在 eclipse 上遇到了同样的错误。
  2. 后来我把动态web模块版本改成了2.5。错误通知消失了。
  3. 然后我再次将我的动态 web 模块版本更改为 3.0 并且错误没有出现;我能够创建该项目。

I dont know the reason though.

虽然我不知道原因。

回答by Enrus

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.

只需将“动态 Web 模块版本”更改为 2.5,然后将其更改回 3.0,错误就会消失。它对我来说很好。

回答by Yubaraj

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

这是迟到的答案。但可能对其他人有帮助。如果您使用的是Maven基于项目。您只需在pom.xml文件中包含以下代码。可以解决。

<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.

更新:同样,如果您使用 jdk 1.8 版,只需将其包含在您的 <source><target>标签中。

回答by Masoud Mustamandi

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

去点击 New Runtime>Apache Tomcat v7.0 (for me)>Finish 在此处输入图片说明

now the error has been removed enter image description here

现在错误已被删除 在此处输入图片说明

回答by Swapnil S

if you are using maven

如果您使用的是 Maven

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

只需将代码添加到 pom.xml 中提到的和 Project> properties> Maven> Update Project 就可以了

回答by EngineSense

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

答案是正确的:),但稍微需要更正。

--> Enable Java compiler to 1.7

--> 启用 Java 编译器到 1.7

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

--> Facet 检查java(不检查动态模块)

--> Last step check Dynamic module

--> 最后一步检查动态模块

:)...

:)...

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

将 java 编译器启用到 1.7 后,然后转到 facet,然后首先检查java而不是 Dynamic 模块。然后它将允许您检查动态模块。

回答by sanLama

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....

如果之前安装了任何不同的 JDK 版本(多于一个 jdk),请卸载所有版本。然后安装新的 jdk(最新)n 以配置 java 环境,请参阅此链接....

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

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.
  1. 右键单击项目>属性>项目事实
  2. 通过使用下拉列表选择右侧的版本来检查 Java。
  3. 检查动态Web模块及其版本(请记住,不同版本的此需要不同版本的TomcatServer,因此安装一步旧版本的tomcatServer)
  4. 现在点击应用n ok。

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

这个问题有不同的原因,但这是大多数情况。在 [email protected] 没有解决联系