Tomcat (download + installation + configuration environment variable tutorial) super detailed

foreword

 Please configure and install the Java environment first, if not installed, please refer to this step to install!

If it has already been configured, please ignore it!

1. Tomcat download

Determine whether your Windows system is 64-bit or 32-bit. (Open this computer, right-click the mouse, and select Properties)

1. Enter the tomcat official website address: https://tomcat.apache.org , find the Download on the left to find the corresponding version of tomcat (you can also enter the Tomcat website through the Apache official website) (I downloaded tomcat10).

Corresponding to the number of operating system to download, after downloading will be a zip compressed package

After downloading, unzip it to the location you set (preferably not on the C drive), here I put it according to my habit.

Do not change the file name inside, or put it in a certain folder on the D drive, and the path must not contain Chinese and special characters! avoid unnecessary trouble

 

Two, Tomcat configuration environment

Click the right mouse button on the computer -> click properties to enter the advanced system settings

Go to Advanced System Settings -> Environment Variables -> New System Variables

1), create a new system variable, the variable name CATALINA_HOME
variable value is the path after you decompressed, you can directly enter the decompressed folder, copy this path to the variable value

2) Find the path in the system variable, click edit, and add at the end%CATALINA_HOME%\bin

Click OK, OK, and then click OK to configure the environment variables 

3. Verify whether the Tomcat configuration environment variables are successful

1) Windows key + R, enter cmd, press Enter

Enter startup.bat in the command line window and press Enter

Success: The Tomcat startup window appears, there is no error or a flash, keep the black window running and cannot be closed, otherwise your tomcat0 server will be closed

Failed: It may be that your port is occupied

You can see that there are garbled characters, don't panic

solution

Open the apache-tomcat-10.0.12->conf->logging.properties file

 Open with Notepad and find java.util.logging.ConsoleHandler.encoding = UTF-8 (here I use notepad++)

Change to java.util.logging.ConsoleHandler.encoding = GBK; at this time open the garbled problem again to solve (does not affect)

Enter http://localhost:8080 in the browser  (you can click directly) to verify whether the environment variable is configured successfully

When the following interface appears, the configuration is successful

Tomcat shutdown: use the shutdown.bat command in cmd or find the shutdown.bat file under tomcat

Note: If you use shutdown in cmd without adding bat, it will cause shutdown. (You can rename the shutdown.bat file)

 

When configuration fails

Situation 1:
The Tomcat window is closed, and not found will also be displayed at this time. The solution is to open Tomcat and then enter the URL for verification.
Situation 2:
The default port 8080 is occupied
At this point you can choose to change the original default port 8080, you can change it to other

Open the apache-tomcat-9.0.45->conf->server.xml file; modify the value of the port ;

Verify again after modification is http://localhost: port port is the modified port number

Guess you like

Origin blog.csdn.net/LShuo666/article/details/124180933