Detailed explanation of Tomcat download and installation and IDEA configuration Tomcat (2023 latest)

Step 1: First confirm whether you have installed JDK

General installation configuration and inspection of jdk versions: https://blog.csdn.net/m0_48170265/article/details/129070240

Step 2: Download and install Tomcat

Tomcat download official website: https://tomcat.apache.org/

DownloadSelect the corresponding Tomcat version on the left :

insert image description here

Generally choose 64 bits:

insert image description here

Step 3: Tomcat configuration environment variables

Right-click on the taskbar Windows(开始), select 系统and高级系统设置

insert image description here

choose环境变量

insert image description here
Select New in the System Variables column:

Variable name:
CATALINA_HOME

Variable value:
E:\ProgramFile\Tomcatlapache-tomcat-8.5.81 (path after decompression)

insert image description here

Find the Path in the system variable and add:
%CATALINA_HOME%\bin

insert image description here

After that keep clicking OK

Step 4: Verify that the Tomcat configuration is successful

First win+ Renter cmdthe carriage return, and then enter startup.batthe carriage return in the DOS window.

After that, the Tomcat startup window will appear.

Or click in the Tomcat installation directory startup.bat , the effect is the same

insert image description here

insert image description here

If there are garbled characters, you can use Notepad++ or Notepad to view the files confin the directorylogging.properties

insert image description here

UTF-8Change here to GBK:

insert image description here

Open again startup.bat:

insert image description here

The black window shown in the figure above appears, indicating that the configuration is successful.

If there is an error or a flash, it may be that the port number is occupied. The default window of Tomcat is 8080.

You can try to restart the computer and start Tomcat again. If not, modify the Tomcat port number.

If the configuration is successful, open the browser and enter http://localhost:8080/

If it is as shown in the figure below, it means success.

insert image description here

Notice:The previous black window must not be closed, otherwise this page cannot be opened; in addition, when the Tomcat server needs to be enabled for programming, the black window cannot be closed, otherwise the Tomcat server cannot be used.

Step 5: Configure Tomcat for IDEA

After creating the web project, we need to configure tomcat to run. The configuration is as follows:
click the lower triangle in the upper right corner and select Edit Configurations...

insert image description here

Click on + the number slide down to find Tomcat Server selectLocal

insert image description here

If you can't find Tomcat Server when you slide down, you may need to click more below to expand

insert image description here

Click configuration, click +the number, and select your own tomcat directory in the next Tomcat Home:

insert image description here

insert image description here

insert image description here

choose:

insert image description here

basically no change

insert image description here

Select "+"→"web", select web.xmlandwebRoot

Path: E:\IdeaProject\Project Name\webRoot\WEB-INF\web.xml

Web resource Directories: E:\IdeaProject\project name\webRoot

insert image description here

insert image description here

Select " +", click java, find the lib package under webroot,
insert image description here
select the project, set

insert image description here
insert image description here

choose:

insert image description here

insert image description here

Click "Edit Configurations" to enter the tomcat service editing page.

insert image description here

Click "Deployment", then "+" and you're done.

insert image description here

Tomcat's directory structure:

insert image description here

Other useful articles :

1. Detailed explanation of Maven download and installation and IDEA configuration Maven :
https://blog.csdn.net/m0_48170265/article/details/129081544

2. Explain the installation and configuration of JDK1.8 and other versions in detail :
https://blog.csdn.net/m0_48170265/article/details/129070240

Guess you like

Origin blog.csdn.net/m0_48170265/article/details/129073985