Table of contents
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/
Download
Select the corresponding Tomcat version on the left :
Generally choose 64 bits:
Step 3: Tomcat configuration environment variables
Right-click on the taskbar Windows(开始)
, select 系统
and高级系统设置
choose环境变量
Select New in the System Variables column:
Variable name:
CATALINA_HOME
Variable value:
E:\ProgramFile\Tomcatlapache-tomcat-8.5.81 (path after decompression)
Find the Path in the system variable and add:
%CATALINA_HOME%\bin
After that keep clicking OK
Step 4: Verify that the Tomcat configuration is successful
First win
+ R
enter cmd
the carriage return, and then enter startup.bat
the 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
If there are garbled characters, you can use Notepad++ or Notepad to view the files conf
in the directorylogging.properties
UTF-8
Change here to GBK
:
Open again startup.bat
:
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.
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...
Click on +
the number → slide down to find Tomcat Server
→ selectLocal
If you can't find Tomcat Server when you slide down, you may need to click more below to expand
Click configuration
, click +
the number, and select your own tomcat directory in the next Tomcat Home:
choose:
basically no change
Select "+"→"web", select web.xml
andwebRoot
Path: E:\IdeaProject\Project Name\webRoot\WEB-INF\web.xml
Web resource Directories: E:\IdeaProject\project name\webRoot
Select " +
", click java, find the lib package under webroot,
select the project, set
choose:
Click "Edit Configurations" to enter the tomcat service editing page.
Click "Deployment", then "+" and you're done.
Tomcat's directory structure:
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