Add tomcat server to eclipse

In this tutorial, I will teach you how to add a tomcat server in Eclipse IDE and other functionality that you would require to develop a web application. It is assumed that you have preliminary knowledge of using eclipse.

Now you have installed Eclipse so the next thing would be to start using Tomcat from inside eclipse.

Steps are

  • What is Tomcat
  • Download Tomcat
  • Add Tomcat in eclipse
  • Add a project in tomcat
  • Run web application in tomcat from eclipse

What is Tomcat

Apache Tomcat (Commonly known as Tomcat) is an open-source web server and servlet container developed by the Apache Software Foundation (ASF). Tomcat implements the Java Servlet and the JavaServer Pages (JSP) specifications from Oracle Corporation (Previously known as Sun Microsystems).

Download Tomcat

To download the current version (7.0.34) of Tomcat please visit here. There are different download links available on this page(32bit/64bit/zip format/tar format..). Select one which is most suitable for you. If you don’t want to go into detail, download the tomcat from the first download link in ZIP format. Once downloaded, extract the folder in the local file system (Assuming extracted file location is “d:/tomcat“). After extraction, the file structure would look like below.

Add Tomcat to Eclipse

It’s time to open Eclipse. Once opened open server view.

Tomcat_1

Currently, there is no server available. You need to add a new one. Click the link “New Server Wizard“. It will show the popup window. Select the proper tomcat version. In the current situation select “Tomcat v7.0 Server” and click “Next“.

Tomcat_2In the Next window browse the folder where you have extracted the tomcat folder just downloaded. Or you can choose the option to Download and Install option available in this window.

Tomcat_3

Tomcat_4

Now click Next. If you have any web project which you want to add to the tomcat server you can do that here on the next screen. If there is any web application in the given workspace then it will get displayed on the left side as below. If you want to add a web application in tomcat select the application and click the Add button. It will be added to the given tomcat instance. Once done with it, click Finish.

Tomcat_5

If everything is fine server view will now have a instance of Tomcat server with JBT application added in it.

Tomcat_6Add Project in Eclipse

What if you have already created an instance of the tomcat in Eclipse and now you want to add a newly created web application to the existing Tomcat server.

To add a newly created web application, select the tomcat instance in which you want to add a web application, right-click and click the “Add and Remove..” menu.

It will open the Add and Remove window. Select the web application which you want to deploy and click Add>.

After adding the application click Finish. Now the server will have two web application in it which can be configured in server view.

Run & Debug web application in tomcat from Eclipse

Now we are done with adding the web application to the server it’s time to run the application. To run tomcat select tomcat right click and then select “Start” (To start the server in run mode) or “Debug” (To start the server in debug mode) menu. It will start the server in the given mode and you can check the output in the console view.

3 Comments Add tomcat server to eclipse

  1. Deepak

    1. There is no server view in Eclipse IDE for Java Developers – 2022-03,

    2. Moreover im getting an error while the tomcat server is started

    Status Report

    Message The requested resource [/MyProjectTool/] is not available

    Description The origin server did not find a current representation for the target resource or is not willing to disclose that one exists.

    Reply

Leave A Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.