Install Tomcat under Mac and the configuration in IDEA

install brew

Open a terminal and enter the following command:

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Search for the tomcat version and enter the following command:

brew search tomcat

image-20230218162947479

Install the version you want, for example, install tomcat@9 here

brew install tomcat@9

image-20230218164221605

If you encounter an error, you can solve it according to the Error prompt

For example, common errors:

image-20230218164320753

Here, install the relevant dependencies according to the prompts brew install openjdkand then run the command to install tomcat again

Verify that the installation was successful:

image-20230218164449507

It is displayed and installed here, if you need to reinstall, uninstall and reinstall

Two ways to run the tomcat server

elegant way

启动:catalina start

停止:catalina stop

Usehomebrew services

启动:brew services start tomcat@9

停止:brew services stop tomcat@9

After the startup is successful, open the browser to visit http://localhost:8080, and the following interface will appear to indicate that the installation is successful

image-20230218164836774

Configure tomcat in IDEA

Enter the following command in the terminal to get the tomcat path

brew ls tomcat@9

image-20230218164941581

Open IDEA and find the edit configuration in run

insert image description here

image-20230218165130491

Click on the upper left corner ➕ and select the tomcat server. Note: not tomee

image-20230218165456483

image-20230218165520882

configuration complete

image-20230218170407165
If you have any questions, please leave a message in the comment area to discuss

Guess you like

Origin blog.csdn.net/qq_43921353/article/details/129102416