Eclipse - 未定义目标运行时 Apache Tomcat v7.0

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

Eclipse - Target runtime Apache Tomcat v7.0 is not defined

eclipsetomcat

提问by user2015827

When I run the application and build it. It doesn't show any error but when I access my application the following error comes in the console.

当我运行应用程序并构建它时。它没有显示任何错误,但是当我访问我的应用程序时,控制台中出现以下错误。

Description Resource Path Location Type Target runtime Apache Tomcat v7.0 is not defined. MyProject Unknown Faceted Project Problem

说明 资源路径 位置 类型 目标运行时 Apache Tomcat v7.0 未定义。MyProject 未知分面项目问题

Can someone help me with this.

有人可以帮我弄这个吗。

回答by Vibhu Dadhichi

The targeted runtime version must be updated. Suppose you are using Tomcat Version 8.0 but in the targeted runtime it shows 7.0 selected.

必须更新目标运行时版本。假设您使用的是 Tomcat 8.0 版,但在目标运行时它显示选择了 7.0。

You need to right click on your project > Properties > Targeted Runtime > Click the version required 8.0I guess. Hope it helps.

您需要右键单击您的项目 > 属性 > 目标运行时 > 单击我猜所需的 8.0 版本。希望能帮助到你。

回答by Areca

Add your Tomcat 7 installation to your targeted runtimes. You can do it under menu Project > Properties > Targeted Runtimes

将 Tomcat 7 安装添加到目标运行时。您可以在菜单 Project > Properties > Targeted Runtimes 下进行

Select your desired runtime and provide the path where it is installed.

选择所需的运行时并提供安装路径。

回答by Michael Shaw

It might be that the org.eclipse.wst.common.project.facet.core.xmlfile in the .settings of your project have changed (e.g. if a colleague checks in their settings and then you pull their changes). In that case the Project > Properties > Targeted Runtimewill be there and even checked (your original will be unchecked) but you will still have a problem.

可能是org.eclipse.wst.common.project.facet.core.xml您项目的 .settings 中的文件已更改(例如,如果同事检查了他们的设置,然后您提取了他们的更改)。在这种情况下,Project > Properties > Targeted Runtime将在那里甚至选中(您的原件将不被选中),但您仍然会遇到问题。

You need to rename your runtime...

您需要重命名运行时...

Window > Preferences > Server > Runtime Environments 

select yours > Edit

选择 yours > Edit

Change the name so that it is the same as your colleagues.

更改名称,使其与您的同事相同。

When you come to using your server that will also need to be updated...

当您开始使用也需要更新的服务器时...

double click on the server > General Information > Runtime Environment 

use the dropdown to select the new name

使用下拉菜单选择新名称

回答by kuzevni

Eclipse Version: OXYGEN, 2017

Eclipse 版本: 氧气,2017

  1. From the Project Explorer, right-click on your project > Properties > Project Facets
  2. On the left-hand panel, click on Runtimestab.
  3. Select the Runtime(Apache Tomcat vX.0) you wish to implement.
  4. Click Apply and Close.
  1. 在 Project Explorer 中,右键单击您的项目 > Properties > Project Facets
  2. 在左侧面板上,单击运行时选项卡。
  3. 选择要实现的运行时(Apache Tomcat vX.0)。
  4. 单击应用并关闭

You should see this specific error go away. Regards.

您应该会看到此特定错误消失。问候。

回答by PowerStat

Go to Window/Preferences then Server/Runtime Environments and add the missing Runtime Environment here.

转到窗口/首选项,然后是服务器/运行时环境,并在此处添加缺少的运行时环境。

回答by Amber

There is probably a simpler way, but installing the J2EE version of Eclipse solved this for me. I had projects set up in an older version of Eclipse, but after upgrading to a newer, standard, version my tomcat project quit working even after installing the Web Tools Platform SDK. So reinstalling with the J2EE version was the easiest thing that worked for me after trying several of the other solutions.

可能有一种更简单的方法,但是安装 J2EE 版本的 Eclipse 为我解决了这个问题。我在旧版本的 Eclipse 中设置了项目,但是在升级到更新的标准版本后,即使安装了 Web Tools Platform SDK,我的 tomcat 项目也无法工作。因此,在尝试了其他几种解决方案后,使用 J2EE 版本重新安装是对我有用的最简单的方法。

回答by Sai Krishna Gajavelli

This error might also cause when tomcat 7.0 directory is not added in preference.You might have installed other version (ex:tomcat 8.0) and pointing 7.0 version which is not available

未在首选项中添加 tomcat 7.0 目录时也可能导致此错误。您可能安装了其他版本(例如:tomcat 8.0)并指向不可用的 7.0 版本

You can change the version in properties>> project facets

您可以在properties>>中更改版本project facets

In runtimetab change the version.

runtime选项卡中更改版本。

enter image description here

在此处输入图片说明