Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install and configure Java backend server Tomcat

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article is about how to install and configure Tomcat, a Java back-end server. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

Introduction

Tomcat is a web container (or web application server). It is a lightweight application server and is the first choice for javaEE programmers to develop and debug servlet and JSP. For a beginner, you can think of Tomcat as a server (although it is only an extension of the Apache server), as long as you deploy the web application to Tomcat and launch it, you can access the web application with a browser.

Installation

Tomcat can be downloaded from the official website. The following is the download link:

Download link: https://tomcat.apache.org/

Just choose the appropriate version to download (the editor chooses version 8.5 of Tomcat).

Select the appropriate compressed package and click to download it.

Extract the downloaded installation package to a non-Chinese directory (good programming habit, do not use Chinese (in the path), and then configure the environment variables.

Adding environment variables is divided into three steps. The first step is to add the bin directory of tomcat to the path variable.

The second step is to create a new system variable named CATALINA_HOME, whose value is the root directory of Tomcat.

The third step, check the JAVA_HOME variable, you can go to the editor of this article to see: detailed explanation! How Win10 configures the Java environment variable.

When you are done, press WIN+R to open and run, enter cmd to open the command prompt, enter startup, and click enter to start. Access localhost:8080, that is, the configuration is successful.

Note: sometimes there will be port occupancy or port misallocation, please read on! Here is how to configure the port.

Use:

The following is the directory structure of Tomcat

Bin contains startup and shutdown script conf contains Tomcat configuration file server.xmllib contains jar files used by Tomcat, such as servlet's jar package logs stores Tomcat log files Temp stores some temporary files webapps contains web project examples, when releasing web applications, by default put the web folder in this directory to automatically generate workTomcat, Tomcat runtime temporary files (such as compiled JSP files). If you delete this directory while Tomcat is running, the JSP page will not run. [sevlet generated by jsp is placed in this directory]

We mainly focus on the two folders marked red, webapps is used to put web applications, and then learn servlet and JSP, the development of the project folder must be placed in this folder to run.

There is a server.xml file in the Conf folder that can be configured for Tomcat. The common configuration is to change the port number. Find the following xml structure in this file (the port number may not be 8080, probably around line 69), and modify the value of port to change the port (and the url when you access the port will also be changed). It is best to use the default port 8080.

Start and stop of Tomcat

The start command is described above, which is startup, and the stop command is shutdown.

Note: the garbled code on the command line when starting Tomcat is caused by a mismatch between the command line character set (default uses gbk) and Tomcat (default uses utf-8). Generally does not affect the use, if the obsessive-compulsive disorder partner can choose to change it (there is a logging.properties file in the conf folder, the value of java.util.logging.ConsoleHandler.encoding can be changed to gbk).

Thank you for reading! This is the end of the article on "how to install and configure the Java back-end server Tomcat". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report