How to deploy Servlet app with Tomcat
It’s a simple thing to do, but I was surprised to read various articles, but I didn’t write the important parts, and I had a headache.
a.Export your Servlet application from eclipse etc. in war file format
From Eclipse, right-click the file of the dynamic project and select Export> Export in War format, and export it to the war file format in any directory.
![Screenshot 2020-07-18 12.29.00.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/485150/3fac72d6-cd7e-f0ca-52c6-(bd58fef60414.png)
These are unnecessary if you originally started Tomcat from Eclipse and are trying it on a local server, but if not, you need to install it.
Install it on your PC using a zip file from this site. http://tomcat.apache.org/download-80.cgi
In the case of Windows, the installation file seems to be different depending on the number of bits, so please install the one that suits your environment. (For Mac, download the zip file.)
![Screenshot 2020-07-18 12.59.51.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/485150/f4756c8d-d527-1446-1b42-(4e440a746345.png)
c. Unzip the installed files
Open the downloaded file and go to the webapps file.
The contents of the file are as follows. From here go to webapps.
![Screenshot 2020-07-18 13.02.44.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/485150/8dd88464-4e7e-b43d-847a-(49c75541275c.png)
Put the war file exported in a in this webapps directory.
d. Change Tomcat permissions
After that, I will start the shell file or batch file in the installed Tomcat folder, but the permission is 644 by default and it may not be possible to start, so in that case, change it with the following command.
$ cd /Applications/apache-tomcat-8.5.57 $ chmod 755 *.sh
2. Start Tomcat
Start the Tomcat shell file with the following command.
Then, the war file in the webapps directory will be compiled and a file with the same name will be created under webapps.
If successful, you will be able to access from this URL.
To finish, enter the following command.