An Illustrated Quick Start Guide

Apache Tomcat makes hosting your applications easy. The Eclipse IDE makes development easy.  It's simple math.  If you haven't integrated Tomcat into your Eclipse environment, you're losing out on some great enhancements to your development process.

Imagine being able to write a new servlet, deploy it to a Tomcat server, test it, make changes, redeploy, and restart Tomcat - all within Eclipse, all without editing a single XML file by hand.  Time-saver?  Sanity-preserver?   All of the above?  You bet.  Here's an easy guide to getting Tomcat and Eclipse working together, from installing the Tomcat plug-in, to configuring your first server.

In the interest of simplicity, this tutorial assumes that you've already installed:

  • a JDK of version 1.4.2 or higher
  • the Tomcat version of your choice (version 5.5.x or higher is recommended)
  • Eclipse 3.1 or higher, along with the EMF (Eclipse Modeling Framework), GEF (Graphical Editing Framework), and JEM (Java EMF Model) components

If you need more information on installing these items, visit the Eclipse and Apache Tomcat documentation pages. And to make your Apache Tomcat environment enterprise ready, learn more about Tcat, the leading enterprise Apache Tomcat application server.

Step One - Installing the Eclipse Web Tools Platform

Eclipse uses a set of components called the Web Tools Platform, or WTP, to integrate application servers into the Eclipse environment.  Although you can download WTP as a ZIP file, it's quite easy to install from within Eclipse, and this is the method we'll use in this tutorial.

To install WTP, select the "Install New Software..." menu item from the Eclipse "Help" menu.  This will call up the dialog pictured below:

Click the "Work with:" drop down menu, and select the WTP Project site from the list:

Next, select the latest version of the WTP SDK from the list of projects.  In this tutorial, we'll use version 3.x:

Click "Next".  Eclipse will fetch a list of components to be installed, and present them to you.  You can review them if you want, but it's not necessary.  Click "Next" again to reach the page "Review Licenses".  Click the radio button in the lower right hand corner of the screen, indicating that you accept the licensing terms for the components that you are about to install (you only need to do this once), and the "Finish" button will become active.

Once you click the "Finish" button, Eclipse will begin downloading the components and installing them:

This process will take some time, so get up and go for a stroll.  If you get any dialogues about installing unsigned content, don't worry - just click "OK".

At the end of the install process, Eclipse will give you the option to either restart, or apply the changes without restarting.  Be safe - restart.  It'll only take a few seconds, and when Eclipse starts up again, you'll be almost ready to start using Tomcat with Eclipse!

Creating Your First Tomcat-Integrated Eclipse Project

Now that you've installed the WTP, it's time to start using Tomcat with Eclipse.  Start clicking "File-->New" and selecting "Dynamic Web Project" from the list of options.  Eclipse will present you with this dialogue window:

This dialogue should be familiar to you if you have used Eclipse before.  What we're concerned with is the "Target runtime" box.  Click "New..." to pull up the following dialogue:

Open the Apache folder, and select the version of Tomcat you've installed on your system.  For this example, we'll be using Tomcat 6.  If you want to create a new local server for your project, check the box below the list of server runtimes.  Click "Next", and Eclipse will ask you to locate your installation of Tomcat:

Click "Finish", configure any additional options you like on the New Dynamic Web Project dialogue screen, click "Finish" one more time, and you're done.  Congratulations - you've created your first Tomcat-integrated Eclipse project.

Configuring a Tomcat Server In Eclipse

Now that you've created a Tomcat-aware project, you still need to define a Tomcat server for the project to use.  You can do this in the "Server" tab, located in the lower half of Eclipse's development screen by default.  Secondary click inside the tab to open the New Server dialogue:

On the next screen, choose a local name for your new server, as well as a Server name, and click Finish.  If you did everything correctly, a new Server will appear in the Server list.  Double-clicking on the server's name will call up a window in which you can edit basic information about the server:

You can also edit Tomcat's Configuration files within Eclipse by selecting them from the Servers drop-down menu in Project Explorer, located on the left hand side of Eclipse's development view:

Running an Application On Your Tomcat Server

Now that you've configured a Tomcat Server for use in your Eclipse project, you can deploy whatever test application you choose to build on the server simply by starting the Server, right-clicking the application in the Project Explorer pane, and choosing Run On Server from the "Run As..." menu option:

That's the basics - the rest is up to you!  For more information about using Eclipse with Apache Tomcat, visit the WTP Tomcat FAQ page.

Apache Tomcat Eclipse Integration的更多相关文章

  1. WEB服务器搭建(Apache+Tomcat+eclipse)

    1.下载xampp安装,选择Apache+MySQL+Tomcat 官方下载链接:https://www.apachefriends.org/zh_cn/download.html 2.下载安装jav ...

  2. 【eclipse】Target runtime Apache Tomcat v7.0 is not defined解决

    在eclipse中导入项目时提示Target runtime Apache Tomcat v7.0 is not defined, 解决方法:右键项目--properties--targeted ru ...

  3. 发现eclipse红叉,查看markers发现Target runtime Apache Tomcat 6.0 is not defined

    1.导入以前的项目(Markers中注意查看,就在console选项卡旁边),报以下错误,但不影响操作: Description Resource Path Location TypeTarget r ...

  4. Eclipse配置tomcat8.5.7报错:The Apache Tomcat installation at this directory is version 8.5.27. A Tomcat 8.0 installation is...

    Eclipse配置tomcat8.5.7报错:The Apache Tomcat installation at this directory is version 8.5.27. A Tomcat ...

  5. eclipse添加web项目报错“Target runtime Apache Tomcat v7.0 is not defined.”

    项目检出后,发现是Tomcat7 发布的,修改文件: 工作空间--->项目名称--->.settings--->org.eclipse.wst.common.project.face ...

  6. 发现eclipse红叉,查看markers发现Target runtime Apache Tomcat v8.0 is not defined

    导入以前的项目(Markers中注意查看,就在console选项卡旁边),报以下错误,但不影响操作: Faceted Project Problem        Target runtime Apa ...

  7. 如何搭建Eclipse +Apache Tomcat配置Java开发环境

    Linux平台下如何搭建Eclipse +Apache Tomcat配置的Java开发环境 本文出自 "李晨光原创技术博客" 博客,请务必保留此出处http://chenguang ...

  8. [Tomcat源码分析] Eclipse中搭建Apache Tomcat源码调试环境

    网上很多文章都推荐使用Ant下载编译,但本地实践中屡屡失败,无法下载. 后来参考 https://blog.csdn.net/xiongyouqiang/article/details/7894107 ...

  9. Eclipse添加tomcat出现 The Apache Tomcat installation at this directory is version 8.5.6. A Tomcat 8.0 installation is expected.

    打开tomcat安装目录:apache-tomcat-8.5.6\lib 找到catalina.jar 用解压缩工具打开 org/apache/catalina/util/ServerInfo.pro ...

随机推荐

  1. 从裸机到实时操作系统RTOS

    最近有点闲,公司新年过后一直没有项目,手头上维护的两个程序也比较稳定. 想起来去年做的商业时钟,做了一半,销售反馈回来说,市场不明朗,不建议往下开展,就搁置了,趁着现在有空,把他捡起来. 原来的代码都 ...

  2. Android 如何避免运行时奔溃

    奔溃问题 android运行的时候难免会有一些空指针(NullPointerException)或者下标越界(IndexOutOfBoundsException),用户使用的过程操作某一个按钮的时候, ...

  3. 从零开始学spring cloud(七) -------- Spring Cloud OpenFegin

    一.OpenFegin 介绍 Feign是一个声明性的Web服务客户端. 它使编写Web服务客户端变得更容易. 要使用Feign,请创建一个界面并对其进行注释. 它具有可插入的注释支持,包括Feign ...

  4. MySQL 的几种进入方式

    对于码农一族来说,新入手电脑后,工具安装,环境搭建是为必备功课.环境搭不好工具装不全,后续的工作开展那就会有相当多的痛点,也会耗去相当多的时间和精力.近日,博主在安装 Mysql 数据库的过程中,一番 ...

  5. CentOS7 Failed to start LSB: Bring up/down解决方法

    刚刚装好的虚拟机突然不能上网了,报错很诡异,具体报错如下: /etc/init.d/network restart Restarting network (via systemctl):  Job f ...

  6. hibernate入门一

    ---恢复内容开始--- hibernate简介: 1.优秀的持久化(通俗讲把内存上的短时间运行信息存储在持久化硬盘上)框架. 2.作用于持久层,因为没什么侵入性,所以同样适用于其他层面上的存储 3. ...

  7. 微信小程序发送ajax

    微信小程序通过 wx.request发送ajax请求 1. GET wx.request({ url: app.globalData.pubSiteUrl + 'user-information/ge ...

  8. Redis5种常用的数据结构

    一.数据结构 五种常用的数据结构:string.hash.list.set.zse,以及三种不常用的:hyperloglog.geospatial.streams. 二.常用数据结构的使用 1.Str ...

  9. tcp拥塞控制 tahoe reno new reno sack

    http://www.docin.com/p-812428366.html http://www.docin.com/p-812428366.html

  10. Chapter_3_JAVA作业

    第三章 一 .课前预习 1.1 简述概念,什么是类?什么是对象? 类:在Java中是一种重要的复合数据类型,是组成类的基本要素.(把众多的事物规划,划分成一类是人类在认识个观世界时采用的思维方法). ...