简体   繁体   English

如何在 eclipse 中添加 Tomcat 服务器

[英]How to add Tomcat Server in eclipse

I just installed Java EE plugin in plain eclipse and I am trying to add tomcat server.我刚刚在普通的 eclipse 中安装了 Java EE 插件,我正在尝试添加 tomcat 服务器。 I opened add new server which showing "Choose the type of server to create" but there is no server list.我打开了显示“选择要创建的服务器类型”的添加新服务器,但没有服务器列表。 How can I add tomcat server?如何添加 tomcat 服务器?

Eclipse: Indigo. Eclipse:靛蓝。

Do as this:这样做:

Windows -> Show View -> Servers

Then in the Servers view, right-click and add new.然后在服务器视图中,右键单击并添加新的。 It will show a pop up containing many server vendors.它将显示一个包含许多服务器供应商的弹出窗口。 Under Apache select Tomcat v7.0 (Depending upon your downloaded server version).在 Apache 下选择 Tomcat v7.0(取决于您下载的服务器版本)。 And in the run time configuration point it to the Tomcat folder you have downloaded.并在运行时配置中将其指向您下载的 Tomcat 文件夹。

You can try this article .你可以试试这篇文章 It has the info you want !!它有你想要的信息!!

The Java EE version of Eclipse is not installed, insted a standard SDK version is installed.未安装 Java EE 版本的 Eclipse,而是安装了标准的 SDK 版本。

You can go to Help > Install New Software then select the Eclipse site from the dropdown (Helios, Kepler depending upon your revision).您可以转到“帮助”>“安装新软件”,然后从下拉列表中选择 Eclipse 站点(Helios、Kepler,具体取决于您的版本)。 Then select the option that shows Java EE.然后选择显示 Java EE 的选项。 Restart Eclipse and you should see the Server list, such as Apache, Oracle, IBM etc.重新启动 Eclipse,您应该会看到 Server 列表,例如 Apache、Oracle、IBM 等。

  1. Go to Server tab转到服务器选项卡在此处输入图片说明

  2. Click on No servers are available.单击没有可用的服务器。 Click this link to create a new server.单击此链接以创建新服务器。

  3. Select Tomcat V8.0 from server type list:从服务器类型列表中选择 Tomcat V8.0: 在此处输入图片说明

  4. Provide path of server:提供服务器路径: 在此处输入图片说明

  5. Click Finish.单击完成。

  6. You will see server added:您将看到添加的服务器: 在此处输入图片说明

  7. Right click->Start右键单击-> 开始

Now you can run your web applications on server.现在您可以在服务器上运行您的 Web 应用程序。

If by mistake , you have deleted your Tomcat Server and Eclipse is not showing more options ( Next button will be inactive ) then in this case follow the bellow steps:如果错误地删除了 Tomcat 服务器并且 Eclipse 没有显示更多选项(下一步按钮将处于非活动状态),那么在这种情况下,请按照以下步骤操作:

  1. First remove the two files from the following path:首先从以下路径中删除两个文件:

    • Path : workspace/.metadata/.plugins/org.eclipse.runtime/.settings/路径:workspace/.metadata/.plugins/org.eclipse.runtime/.settings/
    • And that two files are :这两个文件是:

      1. org.eclipse.wst.server.core.prefs org.eclipse.wst.server.core.prefs
      2. org.eclipse.jst/server.tomcat.core.prefs org.eclipse.jst/server.tomcat.core.prefs
    • After deleting/removing the above two files from the workspace, Restart the Eclipse IDE.从工作区中删除/移除上述两个文件后,重新启动 Eclipse IDE。

    • Change to the Server View, Right Click 'New', Window 'Define a New Server' is shown, --> Select the Apache Folder, choose Tomcat-Version切换到服务器视图,右键单击“新建”,显示“定义新服务器”窗口,--> 选择 Apache 文件夹,选择 Tomcat-Version

    • Browse to the unzipped 'Apache-Tomcat folder', choose the second level浏览到解压后的“Apache-Tomcat 文件夹”,选择第二级

    • Now you are able to add/configure your new Tomcat Server.现在您可以添加/配置新的 Tomcat 服务器。 (Now you will see the ' Next ' button will become active , and you can then follow the normal instructions) (现在您将看到“下一步”按钮将变为活动状态,然后您可以按照正常说明进行操作)

There are different eclipse plugins available to manage Tomcat server and create war file.有不同的 Eclipse 插件可用于管理 Tomcat 服务器和创建 war 文件。

For example you can use tomcatPlugin .例如,您可以使用tomcatPlugin It permits to start/stop and build the war simply.它允许简单地开始/停止和建立战争。 You can read this tutorial .您可以阅读本教程

这是非常简单的步骤,因为您提到您已经安装了 JAVAEE 插件,所以第一步是转到Windows->Show View->Server添加选择 AppacheTOMcat 并选择您下载的 tomcat 版本并设置路径和之后启动服务器。

Most of the time when we download tomcat and extract the file a folder will be created:大多数情况下,当我们下载 tomcat 并解压缩文件时,会创建一个文件夹:

C:\Program Files\apache-tomcat-9.0.1-windows-x64

Inside that actual tomcat folder will be there:在那个实际的 tomcat 文件夹中将有:

C:\Program Files\apache-tomcat-9.0.1-windows-x64\apache-tomcat-9.0.1

so while selecting you need to select inner folder:所以在选择时你需要选择内部文件夹:

C:\Program Files\apache-tomcat-9.0.1-windows-x64\apache-tomcat-9.0.1

instead of the outer.而不是外部。

Right Click on the server tab, go for NEW-> Server.右键单击服务器选项卡,转到 NEW-> Server。 then choose recent version of tomcat server.然后选择最新版本的tomcat服务器。 Click on next, and then give path for your tomcat server.(You can download tomcat server from this link https://tomcat.apache.org/download-80.cgi#8.5.32 ).单击下一步,然后为您的 tomcat 服务器提供路径。(您可以从此链接https://tomcat.apache.org/download-80.cgi#8.5.32下载 tomcat 服务器)。 Click on finish.点击完成。

You can start your server now..!!你现在可以启动你的服务器了..!!

Right on the windows tab select Preferences, go for Server.就在 windows 选项卡上 select 首选项,go 用于服务器。 then choose Runtime Environment.然后选择运行时环境。 Click on Add, then select Apache...choose version of tomact server from this(version you installed) --> then browse the parent directory of bin of Apache tomact server--->then finsh.单击添加,然后单击 select Apache...从这里选择tomact服务器的版本(您安装的版本)-->然后浏览ZE9713AE04A02A810D6F33DD956F4279的bin的父目录到mact server.>---> Click on Windows--> selcet show view-->select server-> click on link -->choose apache--> and choose your version-->then Next -->then Finish.单击 Windows--> 选择显示视图--> 选择服务器-> 单击链接--> 选择 apache--> 并选择您的版本--> 然后下一步 --> 然后完成。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM