获取“不支持项目方面 Java 1.8 版”。在 Eclipse Luna

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/28995358/
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-09-09 05:31:00  来源:igfitidea点击:

Getting "Project facet Java version 1.8 is not supported." in Eclipse Luna

eclipsetomcat7java-8faceteclipse-luna

提问by Orin

I am using up-to-date Eclipse Luna which should be ready for Java 8. However when I choose to create a new server with Tomcat 7 and click Next, in the Add and Remove screen I can't move my project because "Project facet Java version 1.8 is not supported." What is the problem and how can I fix this?

我正在使用最新的 Eclipse Luna,它应该可以用于 Java 8。但是,当我选择使用 Tomcat 7 创建一个新服务器并单击下一步时,在添加和删除屏幕中我无法移动我的项目,因为“项目不支持 facet Java 1.8 版。” 有什么问题,我该如何解决?

回答by Eko

I solved the problem. Go to Project Properties -> Project Facets -> Runtime -> New -> Add a tomcat server and in JRE select JRE1.8.0_XX.

我解决了这个问题。转到 Project Properties -> Project Facets -> Runtime -> New -> Add a tomcat server 并在 JRE 中选择 JRE1.8.0_XX。

Did the work for me

对我来说有效

回答by adhg

In eclipse you can change the java version from your tomcat, see picture:

在 Eclipse 中,您可以从您的 tomcat 更改 java 版本,请参见图片:

enter image description here

在此处输入图片说明

回答by vincent zhang

That is because you just changed your JRE location in the workspace property, which TOMCAT relies on.

那是因为您刚刚更改了 TOMCAT 所依赖的工作区属性中的 JRE 位置。

Please reset your tomcat property accordingly again:

请再次相应地重置您的 tomcat 属性:

windows -> preference -> server -> Runtime Environments. To the right of Runtime Environments, you should see the servers. Remove Tomcat 8.0 and add Tomcat v9.0. Rebuild project. 

You can remove and create it again, or just update it.

您可以删除并重新创建它,或者只是更新它。

回答by Umendra kumar sharma

It is because Java version in your Project Facet is 1.8 make it 1.7. Go to Project Properties -> Project Facets and on right side checkboxes, select java checkbox(It might be already selected) and select the version as 1.7 from dropdown.

这是因为您的 Project Facet 中的 Java 版本是 1.8,使其成为 1.7。转到 Project Properties -> Project Facets 并在右侧复选框中,选择 java 复选框(它可能已被选中)并从下拉列表中选择版本为 1.7。

回答by yakup_y

Window Menu-> Preferences On the left, expand the Server and click Runtime Environments Edit Server Runtime Environment. Choose JDK 1.8 Dont forget rebuild your project.

Window Menu-> Preferences 在左侧,展开 Server 并单击 Runtime Environments Edit Server Runtime Environment。选择 JDK 1.8 不要忘记重建你的项目。

回答by Max Alexander Hanna

Actually I just wanted to add to the knowledge here. I often run into this problem. The thing that solves it for me is to actually change the Compiler compliance level.

其实我只是想补充一下这里的知识。我经常遇到这个问题。为我解决它的事情是实际更改编译器合规性级别。

Do this :

做这个 :

Right click on project -> Properties

右键单击项目-> 属性

Click on Java Compiler Tab

单击 Java 编译器选项卡

UNCHECK Enable Project Specific Settings, then click on the configure workspace settings... link and make sure your compiler compliance level is set to the preferred java version your runtime cannot support.

取消选中启用项目特定设置,然后单击配置工作区设置...链接并确保您的编译器合规性级别设置为您的运行时不支持的首选 Java 版本。

Once done, rebuild your project this may clear the problem.

完成后,重建您的项目,这可能会解决问题。

回答by Vineela Thonupunuri

This might be a problem with the jdk as well. I changed my jdk version from jdk1.8.0_65 to jdk1.8.0_25. IDE version that I have is Version: Luna Service Release 2 (4.4.2).

这也可能是 jdk 的问题。我将 jdk 版本从 jdk1.8.0_65 更改为 jdk1.8.0_25。我拥有的 IDE 版本是版本:Luna Service Release 2 (4.4.2)。