How to deploy a .war on Tomcat on OSX

In this blog post I will start with something simple. These instructions are for beginners who have no experience with Java and don’t know how to deploy a java web application archive file (.war) on Tomcat on OS X (should work on Linux too).

This post assumes you have installed Java and downloaded Tomcat. If you want to know more details about installing Java, Tomcat or deploying on Tomcat, you can find more detailed information in this tutorial How to deploy a Java web application on Tomcat or Wolf Paulus’s detailed article more focused on OS X.

Basically, you just have to

1. Copy the .war file to tomcat/webapps folder

2. Open the Terminal app to move to tomcat/bin folder and start Tomcat server by command

sh startup.sh

If you get error message

Cannot find catalina.sh
This file is needed to run this program

or you get this error message with other shell script file, turn off the Tomcat

sh shutdown.sh

make all shell script files executable by command

chmod +x *.sh 

and start Tomcat server again

sh startup.sh

Your application should be accessible on url http://localhost:8080/"name-of-your-war-file"