Run Tomcat from Eclipse

In this tutorial I will show you how to set up and run Apache Tomcat 8 from Eclipse IDE

So why bother running Tomcat from eclipse? There are several reasons. First you can debug your applications directly, without running Tomcat stand-alone server in debug mode. Second you can run JUnit tests on your app before deploying it. And third you can deploy your apps directly from Eclipse.

If you don’t have installed Apache Tomcat 8 yet, please check my previous tutorial on How to Install and Configure Tomcat 8

Set Up Tomcat in Eclipse

Note: before following the steps below, make sure you are running a newer version of Eclipse IDE. Eclipse versions older than Eclipse Luna 4.4 does not support Tomcat 8 by default. For this tutorial I have used Eclipse Mars 2 for Java EE developers. 


1. In Eclipse for Java EE go to Window -> Preferences in Windows OS (or Eclipse -> Preferences on Mac)

2. Go to Server and click Runtime Environments

Eclipse server preferences

3. Click the “Add….” button

4. In Apache tree select Tomcat 8 and check the checkbox “Create a new local server”

Tomcat 8 runtime environment

5. On the next screen click “Browse….” and select your Tomcat installation directory. In the JRE drop-down select your local Java 8 SE Installation and confirm by clicking the “Finish” button

tomcat installation directory and jre

Tip: Eclipse will use a built-in browser to open your web-apps. You can change this setting to a more convenient browser like Google Chrome or Firefox. To do this go to Window -> Web Browser and select “Default system web browser”

eclipse select web browser

Run Application from Eclipse on Your Local Server

Now that you have configured Tomcat to run from within Eclipse you can easily run your applications on this server. To do that right-click your project in “Project Explorer” and go to Run As -> Run on Server

run on server

On the next screen select your Apache Tomcat 8. This will deploy your App and open it in a browser window for you.

Leave a Reply