Last Updated: October 20, 2022

How to run Web App with apache tomcat on Linux.

Steps:

1.Open Maven project.

 

project-screen1.png
Figure 1. Maven Prjoect.
2.Run project as build. as shown in Figure 2.

 

Right-click → Run As → Maven Build.

run-build-screen2.png
Figure 2. Build screen.

Wait until the build finishes.

3.Navigate to project location then go to the target file. as shown in Figure 3.

 

target-file-screen3.png
Figure 3. Target file.
4.Copy the war file. as shown in Figure 4.

 

target-file-screen3.png
Figure 4. Target file.
5.Paste it in webApps file. as shown in Figure 5.

 

go to /var/libtomcat9/webapps

root-screen4.png
Figure 5. WebApps file.

After pasting the war file, a file will automatically be created with the same name of the war file. as shown in Figure 6.

root-app-screen5.png
Figure 6. WebApps file.
6.Run tomcat with the terminal. as shown in Figure 7.

 

To start tomcat use the following command :

sudo service tomcat9 start
tomcat-screen7.png
Figure 7. Starting tomcate.
7.Go to URL localhost:8080:/app. as shown in Figure 8.

 

8080 is the default port for tomcat.
app-screen6.png
Figure 8. WebApp running on chrome.

Now your WebApp is running on tomcat Enjoy.