mac idea2020.3 configure tomcat and create javaWeb project

tomcat download

 

1. Download and install

Go to the official website to download:  http://tomcat.apache.org/ 

Choose the corresponding version (because my jdk is 1.8, so I chose tomcat8.0)

Download the first resource zip under the Core on the right, unzip it after downloading and rename it ApacheTomcat, and put it under /usr/local/

2. Start the service (start service: ./startup.sh shutdown service: ./shutdown.sh)

Open the terminal and enter the command to switch the path to the bin directory of ApacheTomcat:

cd /usr/local/ApacheTomcat/bin

Execute the startup file:

./startup.sh

If it prompts Permission denied, it is because there is no permission for .sh.

You can use the command to open all .sh file permissions:

chmod u+x *.sh

Execute (./startup.sh) again to start the service, as shown below:

Visit http://localhost:8080 in the browser   to see the prompt: 

3. Modify the port number (if the port number 8080 cannot be used, you can use other ports by modifying the server.xml configuration file under the conf file)

Modify it to 8090, just visit http://localhost:8090 in the browser  

4. Configure Tomcat application management GUI users

Open the tomcat-users.xml under the conf folder to add a user:

<role rolename="manager-gui"/>
<user username="tomcat" password="123456" roles="manager-gui"/>

重新启动服务, Visit  http://localhost:8080  , click on Manager App: the
user name and password are just set tomcat and 123456

 

Configure idea

 

new project-empty Create empty project

new module select java not java Enterprise

Run->Edit Configuration->Plus sign in the upper left corner- >Tomcat Server ( not TomEE  )->Local Configure the directory where tomcat is located

Back to the project interface, right-click the project name->add framwork support->select Web Application->java ee 8 version4-check to create web.xml

Configure Tomcat's Deployment -> the plus sign on the right -> select Artifact

 

Insert picture description here

Guess you like

Origin blog.csdn.net/qq_34626094/article/details/112983937