Downloading and Installing Tomcat

This section provides a tutorial example on how to download and install Apache Tomcat 9 on a Windows system. Tomcat 9 requires JDK 1.8.0.

If you want to learn JSP (JavaServer Page) technology, you should download and install Apache Tomcat on your local machine, so that you can use it to test your JSP pages. Here is what I did to download and install Apache Tomcat 9.0.12 on my Windows local computer.

1. Visit Apache Tomcat home page at http://tomcat.apache.org/ with a Web browser, and click the "Download" link under the "Tomcat 9.0.12 Released" section. You will see the "Tomcat Downloads" page.

2. Click "64-bit Windows zip" link under "Binary Distributions" section. You will see the download file save dialog box.

3. Use the "Save file" option to save the download file "apache-tomcat-9.0.12-windows-x64" to a temporary folder.

4. Unzip "apache-tomcat-9.0.12-windows-x64" to file installation folder \local\tomcat.

5. Try to start Tomcat server by running the "startup" command in a command line window:

herong> \local\tomcat\bin\startup
The CATALINA_HOME environment variable is not defined correctly
This environment variable is needed to run this program

6. To fix the missing environment variable, CATALINA_HOME, I used the "set" command:

herong> set CATALINA_HOME=\local\tomcat

herong> \local\tomcat\bin\startup
The JRE_HOME environment variable is not defined correctly
This environment variable is needed to run this program

7. To fix the second missing environment variable, JRE_HOME, I need to find the path name where Java is installed. By looking the default Java folder, I see JDK 10.0.1 is installed on my local system:

herong> dir \Progra~1\Java
   <DIR>          jdk-10.0.1
   <DIR>          jre-10.0.1

8. Based on the documentation, Tomcat 9 requires JDK 1.8.0 or higher. So I am ready to set "JRE_HOME" and run the "startup" command again:

herong> set JRE_HOME=\Progra~1\Java\jre-10.0.1

herong> \local\tomcat\bin\startup
Using CATALINA_BASE:   "\local\tomcat"
Using CATALINA_HOME:   "\local\tomcat"
Using CATALINA_TMPDIR: "\local\tomcat\temp"
Using JRE_HOME:        "\Progra~1\Java\jre-10.0.1"
Using CLASSPATH:       "\local\tomcat\bin\bootstrap.jar;
   \local\tomcat\bin\tomcat-juli.jar"

I think my Tomcat 9 installation is completed now. See the next tutorial on how to start the Tomcat 9 server properly.

Table of Contents

 About This Book

 JSP (JavaServer Pages) Overview

Tomcat Installation on Windows Systems

Downloading and Installing Tomcat

 Launching Tomcat Server

 Verifying Tomcat Server

 Setting Up Tomcat Server Admin Access

 Reviewing Tomcat Server Status Page

 Tomcat Web Application Manager

 My First HTML Page - hello.html

 My First JSP Page - hello.jsp

 JSP Scripting Elements

 Java Servlet Introduction

 JSP Implicit Objects

 Syntax of JSP Pages and JSP Documents

 JSP Application Session

 Managing Cookies in JSP Pages

 JavaBean Objects and "useBean" Action Elements

 Managing HTTP Response Header Lines

 Non-ASCII Characters Support in JSP Pages

 Performance of JSP Pages

 EL (Expression Language)

 Overview of JSTL (JSP Standard Tag Libraries)

 JSTL Core Library

 JSP Custom Tags

 JSP Java Tag Interface

 Custom Tag Attributes

 Multiple Tags Working Together

 File Upload Test Application

 Using Tomcat on CentOS Systems

 Using Tomcat on macOS Systems

 Connecting to SQL Server from Servlet

 Developing Web Applications with Servlet

 Archived Tutorials

 References

 Full Version in PDF/EPUB