< Prev
Next >

Setting up Tomcat Web Server

Java is essential to execute JSP code. Hence, before you run Tomcat server to execute your JSP code, you need to set the environment variables of Java to make sure that Tomcat is able to find Java in order to execute the JSP code. In order to set environment variables, we need to type in a windows command sysdm.cpl in the search box of the Windows Operating System(Windows 7 to Windows 10), and press Enter to open the window of System Properties.

Figure 2

The next window of System properties open up, we need to click on its tab Advanced.

Figure 3

In this tab Advanced, we need to click on the Environment Variables, in order to set the environment variables for Tomcat web server.

Figure 4

Next, we will explain how to set Environment variables.


Steps to set up the environment variables for Apache Tomcat Server -

This variable is used to specify the location of a Java Runtime Environment(JRE) or a Java Development Kit(JDK), which is required to start Tomcat web server. We have set JRE_HOME environment variable to the location of our Java Runtime Environment(JRE) in our system.

Again, in the window of Environment Variables, click the New to set the variable name to JRE_HOME and variable value to C:\Program Files\Java\jre1.8.0_144 (the location of Java Runtime Environment(JRE) in your system) as shown in the figure below.

Starting the Tomcat web server

After setting these environment variables, we are going to start Tomcat. For this, you need to open the Command Prompt and go to the bin directory of the Tomcat folder present in the C: Drive, such as C:\apache-tomcat-9.0.2\bin and now you type startup(a command which starts the Tomcat Server) and press Enter.

Pressing the Enter after startup command starts the Tomcat web server as shown below.

That's it! Tomcat web server is up and running and we don't have to close the server window till the time we are working on Tomcat.

Making sure that Tomcat is running

Just to make sure that Tomcat web server is running is to open your web browser and enter the URL - http://localhost:8080/, which opens the window with a congratulatory message for successful installation and execution of Tomcat.

8080 is the port number on which Tomcat Server runs by default.


You can change this port number anytime you wish by opening the server.xml file in "C:\apache-tomcat-9.0.2\conf" location and specifying a new port number for the variable Connector port.

Just so you know

Additionally, you can also find the directions of setting the environment variables for Tomcat in the file "running.txt" that comes included with Tomcat.

Please share this article -

< Prev
Next >
< Install Apache Tomcat
First JSP Program >


Please Subscribe

Please subscribe to our social media channels for daily updates.

Decodejava Facebook Page  DecodeJava Twitter Page Decodejava Google+ Page



Please check our latest addition