How To Install Tomcat 9.0 Correctly On Your Machine

In this article i will show you how to correctly install Tomcat 9.0 which is the newest version of it. If you want to install and run it, you need to download and install jdk 8.0 first. Because it only run on jdk 8 or later. Please refer to following page to see the requirement before install.

tomcat 9.0 requirements

Click here to download jdk 8 according to your operating system.

Start From Command-Line

Many web application developers like to run Tomcat from command-line, in most cases they just run it from eclipse they used. Following is the steps to achieve this.

1. Click here to download the zip file.

2.Unzip the zip file into a local folder like C:\WorkSpace\dev2qa.com\Tool\apache-tomcat-9.0.0.M21.

3.Edit conf\web.xml file under your installation directory. It is C:\WorkSpace\dev2qa.com\Tool\apache-tomcat-9.0.0.M21\conf\web.xml in my local windows machine. Search text org.apache.jasper.servlet.JspServlet in web.xml file and add following 2 initial parameters in it like below.

add initial parameters in jsp servlet for tomcat

Tomcat  will compile JSP files with language features provided by Java SE 8 after add these new servlet init parameters.

4.Before you can start it up, you need to set JAVA_HOME system environment variable’s value to the jdk 8 ‘s home you just installed. Please click this link to find how to set JAVA_HOME in windows and Linux. Following is just a picture for setting JAVA_HOME environment variable in windows.

add java_home environment variable

5.After setting JAVA_HOME environment variable, you need restart your dos window or shell window to make the settings take effect. Then you can start it up use startup.bat or startup.sh command in it’s bin folder.

Open a shell window in Linux or a dos window in windows. Type following command to change current directory to your tomcat bin directory.

cd C:\WorkSpace\dev2qa.com\Tool\apache-tomcat-9.0.0.M21\bin

Type startup.bat in windows or startup.sh in Linux and click Enter key. Then Java console window popup and displaying the log information generated by Tomcat process. When you see the message like “Server startup in 1000 ms” in java console, that means it has been started successfully and is ready to process client request.

READ :   Deploy And Undeploy Java EE Web Applications In Tomcat

tomcat startup successful console log

6. Put url http://localhost:8080/ in your favorite web browser’s url address input box and click Enter key. Then you will see below page, if not then your Tomcat may not start correctly, you need to review previous steps carefully.

tomcat start successful

Install as windows service

Install and run Tomcat as windows service is commonly used in production and quality assurance environment.

Advantages of windows service

  1. Server startup do not need active administrator login.
  2. Automatically startup when your server restart. This is very useful because in many cases you may need to restart your windows server. With this feature you do not need to login to your windows to start it again after os restart. Because as a windows service it will start automatically when os started.
  3. It is more secure when run it under a specific system account than administrator account.

Steps to install as windows service

  1. Download Tomcat windows installer file.
  2. Click the installer to install use default settings step by step.
  3. When you click Finish button at the last screen. It will popup a progress bar to tell you that it just installing windows services.
  4. After installation, you can find following menu in the system startup menu.
    configure tomcat menu
  5. When you click above menu, a dialog popup, we can use this dialog to configure a lot of settings of it.
    configure tomcat settings dialog
  6. You can configure to start it manually or automatically when windows start. You can also stop, pause, restart it by clicking different buttons.

Different between Tomcat9.exe and Tomcat9w.exe

There are two wrapper program in it’s bin directory.

tomcat9.exe vs tomcat9w.exe

Tomcat9.exe is the wrapper program that make it run as a windows service at the background. We can see this from below picture.

READ :   Introduction To Java File Class

tomcat9.exe is the main wrapper program that run it as windows service

You can run it with a a lot of input parameters. You can find all the parameters description and how to use them by click here.

Tomcat9w.exe is just the wrapper program which will popup the tomcat configure panel. You can do a lot of configuration in that panel.

configure tomcat settings dialog

You can also leave comments in this article. Our expert will response to you asap.

(Visited 1,144 times, 13 visits today)

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.