Apache Tomcat is a free and open source Servlet container for JavaServer Pages. With version 7.0, it supports Java Servlet spec 3.0 and JSP spec 2.2.
It is very easy to install on your computer. You can use it to develop and run web applications. A web application in the context of JavaServer Pages means developing an application that makes use of JSP pages, Servlets, Filters, JDBC, JSP custom tags and other Java based server-side technologies.
In the rest of this tutorial, I will walk you through installing Apache Tomcat 7.0 server on your Windows Operating System.
Step 1: Download and install JDK 6.0
If you already don't have JDK (Java Development Kit) 6.0 installed on your system then you should visit Java SE Downloads page and download latest JDK 6.0 release build along with all the documentation on your computer.
As shown in the image above, a JDK includes both the JRE (Java Runtime Environment) to run Java based applications (like Apache Tomcat server) and applets, and Java compiler and debugger to assist you in developing Java applications.
How to know which version of Java you have on your computer?
If you are unsure which version of Java is installed on your computer then open Command Prompt, enter the following command and press the Enter button:
If Java is installed on your system and the full path to
Java.exe is included in the
PATH environment variable on your computer then Java version information should appear on your screen as shown below:
Now that you have a working copy of latest release build of JDK 6.0 on your computer, you should proceed to download Apache Tomcat server.
Step 2: Download Apache Tomcat
Go to the download page for Apache Tomcat 7.0. Scroll down the page a little until you get to Binary Distributions.
Click on the appropriate link for your Operating System to download the file on your computer. In my case, I chose "64-bit Windows zip" as I was running Windows 7 on a 64-bit processor.
Now that you have the latest binary build of Apache Tomcat 7.0 on your computer, proceed to the unpack the zip file.
Step 3: Unzip Apache Tomcat
Now unzip the downloaded zip file into a convenient location on your hard drive. In my case, I unzipped it into "C:\apache-tomcat-7.0.14".
If you don't have a utility program to unzip .zip files on your computer, you can download and install the free 7-Zip utility to easily zip and unzip files on your computer.
Now that you have unzipped the file into a convenient location, you should proceed to setup the environment variables.
Step 4: Setup environmental variables
Go to Start Menu -> Control Panel -> System. When the window opens up for the System settings, click the link to "Advanced system settings" as shown in the image below:
When the System Properties window opens, click the "Environment Variables" button as shown in the image below:
Now click the "New" button in the Environment Variables window to add a new System variable:
Now enter the Variable name as "JAVA_HOME" and Variable value as "C:\Program Files\Java\jdk1.6.0_25" or whatever the complete path to the folder where your JDK was installed is, and press the OK button.
Now close all the open windows and proceed to start the Apache Tomcat server for the first time.
Step 5: Start Apache Tomcat
Now open Command Prompt and enter commands as shown in the image below to change directory to the bin folder of the Apache Tomcat's installation folder. On my computer, I unzipped the Apache Tomcat zip file in the "C:\apache-tomcat-7.0.14" folder.
Once there, type the
startup command and hit the Enter button to startup Apache Tomcat server for the first time on your computer.
A new window pops up and shows the startup log of the Apache Tomcat server as shown in the image below:
Now please open your browser and enter this address in the address field:
http://localhost:8080 and hit the Enter button to load the home page of your local Apache Tomcat server. You should see a home page with a message of success as shown in the image below:
Congratulations! You just finished installing and running Apache Tomcat 7.0 server for the first time on your computer.
Play with the Servlet and JSP Examples
You can click the "Servlet Examples" and "JSP Examples" links found on the home page of your local Apache Tomcat server to see the demos of live working Servlets and JSP pages.
Shutting down Apache Tomcat
To shut down Apache Tomcat, simply run this command while in the Apache Tomcat's
Now you have a working copy of Apache Tomcat on your computer. Good luck with learning and developing JSP web applications!