< Prev
Next >



Setting up Tomcat Web Server



Tomcat web server is essential to execute Servlet code. Hence, before you run Tomcat server to execute your Servlet code, you need to set the environment variables of Tomcat to make sure it is able to find Java in order to execute the Servlet 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 a 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 setup 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, clicking 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 browswer 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.




Note:


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 fine the directions of setting the environment variables for Tomcat in the file "running.txt" that comes included with Tomcat.




Please share this article -

Facebook Google Pinterest Reddit Tumblr Twitter



< Prev
Next >
< Install Apache Tomcat
Setting the classpath for Servlets >
Please subscribe our social media channels for notifications, we post a new article everyday.

Decodejava Google+ Page Decodejava Facebook Page  DecodeJava Twitter Page

Coming Next
-
C++ and Python

Ad2