Tomcat installation and configuration (detailed tutorial)

1. Install the Tomcat server

1. Download address (Tomcat official website) http://tomcat.apache.org/

3f37a9118ba94761a49a489f8df88513.png

2. Unzip the downloaded zip file to the specified directory (for example: D disk, the directory should not contain Chinese)

   D:\apache-tomcat-9.0.43

2. Configure Tomcat environment variables

(1) Copy the installation path of Tomcat (D:\apache-tomcat-9.0.43)

(2) This Computer→Properties→Advanced System Settings→Environment Variables

(3) System variables→New→Variable name: CATALINA_HOME Variable value: Tomcat installation path→OK

7ce58cb0c09c421d83cb5145133b8af5.jpeg

(4) System Variables→Path→Edit→New→Enter %CATALINA_HOME%\bin

41137e031dcc48f6b0d13d024a038794.jpeg

(5) OK→OK→OK

3. Start and test Tomcat

1. Start Tomcat

  Find startup.bat in the bin directory under the Tomcat installation path, double-click to run it, and keep the window open

507c2b8d11104b4ca5f52b41fd58126b.jpeg

2. Test Tomcat

   Open the browser, enter http://localhost:8080/ or http://127.0.0.1:8080/ in the address bar, you can see the Tomcat home page and start successfully (if there is a flashback phenomenon, please check whether the environment variable configuration is correct)

1875a03845cd4997bdf2092043ff2a7d.png

3. Close the Tomcat window, the Tomcat server is closed

4. Install Eclipse

1. Download address https://www.eclipse.org/downloads/packages/

  Choose Eclipse IDE for Enterprise Java and Web Developers, and choose the version that matches your own operating system according to your needs

2. Unzip the installation package to the installation directory (for example: D drive)

3. Open the eclipse directory, double-click eclipse.exe

4. Workspace selects the working path, which can be left unchanged by default (you can also create a new folder in the D drive), check Use this as the default and do not ask again, and click Launch

51582f5d38544a2398ff940f0bf48246.jpeg

5. The Welcome interface appears, and the installation is successful

4ba2a6d2e34f4c59ad4553f8dd531400.jpeg

Five, Eclipse integrated Tomcat

1. Open Eclipse, click "Window", select "Preferences"

2. Find "Server", select "Runtime Environments", and click "Add"

23a364cb753347b4898bcd8ea34b854a.jpeg

3. Select the Tomcat version and click "Next"

22d63e0564ee42a587d083004854041f.jpeg

4. Find the Tomcat installation path and click "Finish" to complete

070babdede0f416f85ccda47956b404c.jpeg

5. Click "Apply and Close"

0511a67f1b504e83b70a5ba6363395dc.jpeg

6.File→New→Dynamic Web Project

7.Project name (project name): Test, click "Next"

5bbd4555bcc64a919678a12d4b9e68e7.jpeg

8.Next→Check Generate web.xml deployment descriptor→Finish

77cfa068c6774f39ab408fa32569d6ac.jpeg

9. Create a new HTML File under the WebContent folder in the Test project, name it index.html, and click "Finish"

0f5750c01bd143e99cf11adde24ba043.jpeg

10. Write any statement (for example: Hello World) on the index.html page and do a test

7108b0021eb54291b3ddf04edbd404ff.png

11. Find Servers at the bottom of the window, click No servers are available.Click this link to create a new server... link

2eb1c35953474a3e958ae273c26914a2.png

12. No modification, click "Next"

f11bdfdaf72240deaf88198976b0b0a5.jpeg

13. Click "Add" and then click "Finish"

456884d992484fb1b6d8cb1707265e52.jpeg

14. Right-click Tomcat v9.0 Server at localhost[Stopped,Synchronized], click "Start"

e25ba8d6a95f4ec8bdc739751b90b890.png

15. Right click on the index.html page, select "Run on Server" under "Run As", and then click "Finish"

6c29373012e34195861afb8ba3ff59f4.jpeg

15. The following effect appears, Tomcat integration is successful

7c1c5384d3b04b868a5fe5fb72405ec0.png

Guess you like

Origin blog.csdn.net/weixin_65213208/article/details/126911814