Server Tomcat, will you install it?

Server Tomcat, will you install it?

Tomcat is the smallest WEB container that conforms to the JavaEE WEB standard . All JSP programs must be supported by the WEB container to run, and transaction processing operations are supported in a given WEB container.

Tomcat is provided by Apache (, you can use the installation version and decompression version, the installation version can appear a Tomcat service in the service, no need to install, use the free installation version in development. Simply put, Tomcat is a web server running Java. The bottom layer is a program of Socket . It is also a container of JSP and Servlet. Tomcat is a core project in the Jakarta project of the Apache Software Foundation, which is jointly developed by Apache, Sun, and some other companies and individuals.

Thanks to Sun's participation and support, the latest Servlet and JSP specifications can always be reflected in Tomcat. Because Tomcat has advanced technology, stable performance, and free of charge, it is loved by Java enthusiasts and recognized by some software developers, making it a popular Web application server .

Tomcat server is a free and open-source Web application server, which is a lightweight application server. It is commonly used in small and medium-sized systems and where there are not many concurrent users. It is the first choice for developing and debugging JSP programs. For a beginner, you can think of it this way. When an Apache server is configured on a machine, it can be used to respond to HTML (an application under the Standard Universal Markup Language) page access request. In fact, the Tomcat part is an extension of the Apache server, but it runs independently, so when you run tomcat, it actually runs as a separate process from Apache.

When configured correctly, Apache serves HTML pages, while Tomcat is actually running JSP pages and servlets. In addition, Tomcat, like IIS and other Web servers, has the function of processing HTML pages. In addition, it is also a Servlet and JSP container. The independent Servlet container is the default mode of Tomcat. However, Tomcat is not as capable of handling static HTML as the Apache server. The latest version of Tomcat is currently 9.0.

Tomcat installation method

  • Ensure that the JDK environment is configured correctly
  • Download the Tomcat installation package from the official website
  • Unzip the installation package
  • Integration into compilation tools

Case practice

Running Tomcat requires JDK support [Tomcat will find the required JDK through JAVA_HOME ]. Installation is the decompression process. Start Tomcat, if you can access it, it will be installed

1. Unzip

2. View the index.html or index.jsp file in the ROOT directory

Tomcat8 comes with a page, but tomcat7 does not have a free installation. If you visit directly, you will get a 404 Tomcat7.XXX. You need to check whether there is index.html or index.jsp in the webapps->ROOT directory. If not, manually add an html by yourself File or copy a jsp to other places, then the configuration is successful if you can access the page.

3. Start Tomcat (use the command line to start tomcat in the bin directory under the tomcat installation directory)

The startup window cannot be closed after startup

4. Open the browser and enter http://localhost:8080/to visit

OK, Tomcat is installed successfully.

5. Close Tomcat (use the command line to close tomcat in the bin directory under the tomcat installation directory)

PS: Obtaining learning resources and technical dry goods: lezijie006 (sign 13)


Tomcat directory structure

  1. bin: bat file to start and close tomcat
  2. conf: configuration file server.xml This file is used to configure server-related information, such as the port number of tomcat startup, configuration host (Host) web.xml file configuration and web application (web application is equivalent to a web site) tomcat-user. xml configuration user name password and related permissions.
  3. lib: This directory contains the jar packages needed to run tomcat
  4. logs: store logs, when we need to view logs, we can query information
  5. webapps: Place our web applications
  6. work directory: This directory is used to store the corresponding server files and .class files generated after jsp is accessed

Eclipse related to Tomcat

Window preferences Server Runtime Environment add apache-tomcat-8.0.23