Eclipse 没有 Java facet 1.8 版

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

Eclipse has no Java facet version 1.8

eclipsejava-8m2eclipse

提问by msknapp

I am using eclipse Kepler (enterprise edition), Java 8, and M2Eclipse and trying to make a web application. I have already gone to help -> eclipse marketplace and installed these two patches:

我正在使用 eclipse Kepler(企业版)、Java 8 和 M2Eclipse,并尝试制作一个 Web 应用程序。我已经去帮助-> eclipse 市场并安装了这两个补丁:

  • Java 8 support for Eclipse Kepler SR2
  • Java 8 support for m2e for Eclipse Kepler SR2
  • Java 8 对 Eclipse Kepler SR2 的支持
  • Java 8 支持 Eclipse Kepler SR2 的 m2e

Those patches cleared up a lot of my problems, but one remains. I did a maven -> update from within eclipse, it went and updated all my projects except the only web app in my workspace. It gives me a pop up message that says "Version 1.8 of project facet java does not exist"

这些补丁解决了我的很多问题,但仍然存在一个问题。我做了一个 maven -> 从 eclipse 中更新,它去更新了我的所有项目,除了我工作区中唯一的 Web 应用程序。它给了我一条弹出消息,上面写着“项目方面 java 的 1.8 版不存在”

I opened my project properties and clicked Project Facets. Sure enough, the java facet maximum version is 1.7. So I am wondering why I don't have the same problem on my other projects. I viewed the properties on my other projects and discovered that none of them are using Project Facets at all. I think this might be because I made all of the previous projects using a standard edition of eclipse, not an enterprise edition.

我打开了我的项目属性并单击了 Project Facets。果然,java facet最高版本是1.7。所以我想知道为什么我的其他项目没有同样的问题。我查看了其他项目的属性,发现它们根本没有使用 Project Facets。我想这可能是因为我之前的所有项目都是使用标准版的 eclipse 制作的,而不是企业版。

So I guess I have a couple questions. How can I get eclipse to recognize the java facet 1.8? Is there a way I can have my web app not use Project Facets? Should I add Project Facets to my other projects?

所以我想我有几个问题。我怎样才能让 eclipse 识别 java facet 1.8?有没有办法让我的网络应用程序不使用 Project Facets?我应该将 Project Facet 添加到我的其他项目中吗?

回答by Obada Kadri

Just ran into this issue. My problem was with the tomcat server looking in the wrong place for the JRE. To fix that:

刚遇到这个问题。我的问题是 tomcat 服务器在错误的位置寻找 JRE。要解决这个问题:

  • Double click on the server in the servers tab
  • Open "Runtime Environment"
  • Change the JRE selector.
  • 在服务器选项卡中双击服务器
  • 打开“运行时环境”
  • 更改 JRE 选择器。

Hope this saves someones time

希望这可以节省某人的时间

回答by Sreeja Mohan

I am using 4.3.2 version of Eclipse Kepler SR2 and ran into the same issue when the java version was bumped up from 1.7 to 1.8 for our maven project.

我正在使用 Eclipse Kepler SR2 的 4.3.2 版本,当我们的 maven 项目的 java 版本从 1.7 提升到 1.8 时遇到了同样的问题。

I was getting the following error while trying to do Maven Update : An internal error occurred during: "Updating Maven Project". Version 1.8 of project facet java does not exist.

尝试执行 Maven 更新时出现以下错误:“更新 Maven 项目”期间发生内部错误。项目方面 java 1.8 版不存在。

If you check the Java Project Facet Version (Right click on project -> Properties -> Search for Project Facets -> Java (Version)) .. it must be an older version.

如果您检查 Java 项目方面版本(右键单击项目 -> 属性 -> 搜索项目方面 -> Java(版本))..它必须是旧版本。

Project Facet Screenshot

项目构面截图

Solution :

解决方案 :

Goto Eclipse Marketplace and install the following :

转到 Eclipse Marketplace 并安装以下内容:

  1. Java 8 support for Eclipse Kepler SR2
  2. Java 8 Facet for Web Tools for Eclipse Kepler SR2
  1. Java 8 对 Eclipse Kepler SR2 的支持
  2. Java 8 Facet for Web Tools for Eclipse Kepler SR2

Now, change the Java Project Facet Version to 1.8

现在,将 Java Project Facet 版本更改为 1.8

Right click on project -> Properties -> Search for Project Facets -> Java (Version)

右键单击项目 -> 属性 -> 搜索项目方面 -> Java(版本)

Now, you should be able to successfully take a maven update.

现在,您应该能够成功进行 Maven 更新。

回答by srikanth r

To fix this in eclipse, go to "Help" --> "Market Place" --> Search java 8 kepler. Then install all the 3 below plugins

要在 Eclipse 中解决此问题,请转到“帮助”-->“市场”--> 搜索 java 8 开普勒。然后安装以下所有 3 个插件

install Java 8 support eclipse kepler sr2, install Java 8 Facets for web tools eclipse kepler sr2 install Java 8 support for m2e for Eclipse Kepler SR2 (if you are using maven)

安装 Java 8 支持 eclipse kepler sr2,为 web 工具安装 Java 8 Facets eclipse kepler sr2 为 Eclipse Kepler SR2 安装对 m2e 的 Java 8 支持(如果您使用的是 maven)

Reference: http://www.eclipse.org/downloads/java8/

参考:http: //www.eclipse.org/downloads/java8/

or You can try this

或者你可以试试这个

Select Project properties -->Project facets than at there change your java to the version of your workspace.

选择 Project properties -->Project facets 然后将您的 java 更改为您工作区的版本。

回答by Jigar Joshi

right click on your project > properties > java > compiler > compliance level > set it to 1.8

右键单击您的项目 > 属性 > Java > 编译器 > 合规级别 > 将其设置为 1.8

回答by Phoenix

I too faced the same problem. I did like the below.

我也面临同样的问题。我确实喜欢下面的。

Right click on your project -> Build Path -> Configure Build Path.

右键单击您的项目 -> 构建路径 -> 配置构建路径。

On that, select Java Build Path, if there is any wrong mark indicated in the JRE System Library, select Library Tab and add JRE Library.

在那,选择Java Build Path,如果JRE System Library中有任何错误标记,选择Library Tab并添加JRE Library。

Once JRE Library added successfully, select the JRE System Library in Order and Export Tab and then click ok.

JRE 库添加成功后,在“订单”和“导出”选项卡中选择“JRE 系统库”,然后单击“确定”。

Then restart your eclipse.

然后重新启动你的日食。

Hope it may help you.

希望它可以帮助你。

回答by sg811

I had the same issue when our project upgraded from jdk 1.7 to 1.8 and server Tomcat to JBOSS. When I checked the Targeted Runtimes (Project-->right click-->properties-->Targeted Runtimes), it was pointing to Tomcat, and as I changed it to JBOSS the Project facets gave me java 1.8 version.

当我们的项目从 jdk 1.7 升级到 1.8 并将服务器 Tomcat 升级到 JBOSS 时,我遇到了同样的问题。当我检查目标运行时(项目--> 右键单击​​--> 属性--> 目标运行时)时,它指向 Tomcat,当我将其更改为 JBOSS 时,项目方面给了我 java 1.8 版本。