Java 从 Eclipse 中的项目中删除 Apache TomCat 运行时?

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

Removing the Apache TomCat runtime from a project in Eclipse?

javaeclipsetomcat

提问by Omar Kooheji

I've got a project I've been building on Eclipse Ganymede targetted at tomcat 6.0, I've imported it into Europa and I need it to run on apache Tomcat 5.5

我有一个在 Eclipse Ganymede 上构建的项目,目标是 tomcat 6.0,我已经将它导入 Europa,我需要它在 apache Tomcat 5.5 上运行

I can't find the reference to where the runtime is set to 6.0 to remove it. I've tried going to Windows > preferences > Server and I've installed the 5.5 runtime.

我找不到将运行时设置为 6.0 以将其删除的参考。我试过转到 Windows > 首选项 > 服务器,并且我已经安装了 5.5 运行时。

I can't however seem to find where the reference is to runtime 6.0 to remove it.

但是,我似乎无法找到对运行时 6.0 的引用以将其删除。

Any help would be appreciated.

任何帮助,将不胜感激。

Update:

更新:

I cant find any reference to Tomcat v6.0 in my build path, there is a reference to the servlet-api.jar of tomcat 5.5 though...

我在我的构建路径中找不到任何对 Tomcat v6.0 的引用,但是有一个对 tomcat 5.5 的 servlet-api.jar 的引用......

回答by Suvesh Pratapa

When Eclipse is up and running, choose preferences from the window menu. Choose from the bar on the left: Server, Runtime Environments.

当 Eclipse 启动并运行时,从窗口菜单中选择首选项。从左侧栏中选择:服务器、运行时环境。

Click the button Add, choose the version you want.

单击“添加”按钮,选择您想要的版本。

To remove the 6.0 reference, goto the libraries tab.

要删除 6.0 引用,请转到库选项卡。

回答by kgiannakakis

Open the Build Path and go to the Libraries tab. Remove the Apache Tomcat 6.0 library and add 5.5. This is the library that your project uses to build it self.

打开构建路径并转到库选项卡。删除 Apache Tomcat 6.0 库并添加 5.5。这是您的项目用于自行构建的库。

You can add new runtimes for running your project in the Servers view (Right-Click, Add new Server)

您可以在服务器视图中添加新的运行时来运行您的项目(右键单击,添加新服务器)

回答by Omar Kooheji

Unloading the project and reloading it fixed it... Man I love Eclipse...

卸载项目并重新加载它修复了它......我爱Eclipse......

回答by Artem Barger

You can also just define a new server for that, and specify it there, also you can change server configuration just by double clicking on it you will see window with it's properties.

您也可以为此定义一个新服务器,并在那里指定它,您也可以通过双击它来更改服务器配置,您将看到带有其属性的窗口。

回答by Duccio Fabbri

I had a similar problem. I had a prject referring to a no more existing Tomcat instance. I was not able to remove Tomcat from "Server" and "Runtime Environments" from UI (delete button always gray),so I solved the problem deleting all the reference from the filesystem:

我有一个类似的问题。我有一个项目指的是不再存在的 Tomcat 实例。我无法从 UI 的“服务器”和“运行时环境”中删除 Tomcat(删除按钮总是灰色),所以我解决了从文件系统中删除所有引用的问题:

In project folder check files:

在项目文件夹中检查文件:

  • .classpath
  • .settings/org.eclipse.wst.common.project.facet.core.xml
  • .classpath
  • .settings/org.eclipse.wst.common.project.facet.core.xml

In workspace folder check:

在工作区文件夹中检查:

  • .metadata.plugins\org.eclipse.debug.core
  • .metadata.plugins\org.eclipse.wst.server.core
  • .metadata.plugins\org.eclipse.core.runtime.settings\org.eclipse.jst.server.tomcat.core.prefs
  • .metadata.plugins\org.eclipse.debug.core
  • .metadata.plugins\org.eclipse.wst.server.core
  • .metadata.plugins\org.eclipse.core.runtime.settings\org.eclipse.jst.server.tomcat.core.prefs

Maybe a bit brutal but I didn't find a better solution.

也许有点残酷,但我没有找到更好的解决方案。

回答by Hari Perev

Yep, I have eclipse Version: Indigo Service Release 2; Build id: 20120216-1857, unfortunately deleting the workspace solve the problem with having old Target Runtime. Don't forget to copy all your project work if there is no source control ;) ....

是的,我有 Eclipse 版本:Indigo Service Release 2;构建 ID:20120216-1857,不幸的是删除工作区解决了旧目标运行时的问题。如果没有源代码控制,请不要忘记复制所有项目工作;) ....

回答by Kermit_ice_tea

Delete the old server and add a new server. I had the same problem due to the fact that i changed the runtime environment to Java EE (for a webservice) and later had problems running my local apps. All i did was to delete and create a new server instance with apache runtime.

删除旧服务器并添加新服务器。我遇到了同样的问题,因为我将运行时环境更改为 Java EE(用于 Web 服务),后来在运行本地应用程序时遇到了问题。我所做的只是删除并使用 apache 运行时创建一个新的服务器实例。

回答by nekperu15739

This was tested over Eclipse Luna 4.4.2

这是在 Eclipse Luna 4.4.2 上测试的

In {workspace-directory}/.metadata/.plugins/org.eclipse.core.runtime/.settings. delete the following two files:

在 {workspace-directory}/.metadata/.plugins/org.eclipse.core.runtime/.settings 中。删除以下两个文件:

  • org.eclipse.wst.server.core.prefs
  • org.eclipse.jst.server.tomcat.core.prefs
  • org.eclipse.wst.server.core.prefs
  • org.eclipse.jst.server.tomcat.core.prefs

Restart Eclipse

重启 Eclipse

回答by Accollativo

You can delete a Runtime easily from here, with no mess up:

您可以从这里轻松删除运行时,不会出现任何混乱:

Windows->Preferences->Server->Runtime Enviroments

Windows->首选项->服务器->运行时环境

回答by theRiley

after removing the installed runtime from eclipse, do the following:

从 Eclipse 中删除已安装的运行时后,执行以下操作:

1] Close Eclipse

2] In {workspace-directory}/.metadata/.plugins/org.eclipse.core.runtime/.settings. delete the following two files:
    org.eclipse.wst.server.core.prefs
    org.eclipse.jst.server.tomcat.core.prefs

3] Restart Eclipse

ref: http://crunchify.com/eclipse-how-to-fix-installing-apache-tomcat-server-issue-blank-server-name-field/

参考:http: //crunchify.com/eclipse-how-to-fix-installing-apache-tomcat-server-issue-blank-server-name-field/