Download and install Tomcat10

Small chat: This content is the download, installation and usage test of Tomcat. Although it is very simple, this article is written for those in need. Xiaobai's operation tutorials are all manually operated when writing articles and then recorded. There are process diagrams and instructions, so the content and steps will be more detailed. I hope it can help you.


1. Select the version to download

Official website address: http://tomcat.apache.org/
insert image description here

Here I take the current Tomcat10.0.27 as an example. In fact, the operation is the same. Select the Core core binary compressed package and select the appropriate operating system version.

Note: There is a difference between Tomcat10.x and previous versions, that is, when using the main package of Java API , it must be replaced with .javax.*jakarta.*

Expansion: SpringBoot2 is not yet compatible with jakarta namespace changes. Therefore, the latest SpringBoot2 built-in version is still Tomcat9 . So use SpringBoot3 , SpringBoot3 will migrate to Java 17 and the Jakarta namespace, pushing the ecosystem beyond Java 8. This is a major revision that will be based on Spring Framework 6.0 and requires Java 17 or later. It will also be the first Spring Boot release to use Jakarta EE 9 APIs ( jakarta.*) instead of EE 8 ( ). javax.*Most importantly, it is expected to be released this month (2022.11).


2. Unzip and install

Unzip to the current directory, you can download multiple versions without conflict, just select the version when using it.

Note: It is recommended not to have Chinese and spaces in the installation directory; if you uninstall, just delete it directly.

insert image description here


3. Test use: start and stop

  • Table of contents

insert image description here

  • command, enter the bin directory, double-click to execute the file
# 启动
bin/startup.bat #window
bin/startup.sh #Linux
# 停止
bin/shutdown.bat #window
bin/shutdown.sh #Linux
  • Pop-up window, browser access: http://localhost:8080. The official website page appears to indicate that the startup is successful

insert image description here
insert image description here


4. Problems that may be encountered when starting

  • black window flashes by

    • Reason: The JAVA_HOME environment variable (jdk environment) is not configured correctly

    • Solution: Correctly configure the JAVA_HOME environment variable

  • start error

    • Reason: It may be that the default port 8080 is already occupied
    • Solution: Modify your own port number:
      • conf/server.xml

        generally changes the default port number of tomcat to 80, which is the default port number of the http protocol.
      • Advantage: When accessing, there is no need to enter the port number
  • Garbled characters (recommended solution)

Go to the conf directory to find the logging.properties file, and change all utf-8 to gbk;
insert image description here
start tomcat again, and find that the startup window is no longer garbled (if an error is reported, the last startup may not be closed, stop it)
insert image description here


essay

insert image description here

Guess you like

Origin blog.csdn.net/m0_48489737/article/details/127707346