Installing Tomcat on macOS / Mac OS X
To get Tomcat, visit the following link: http://tomcat.apache.org/. Once there, click on one of the Tomcat versions such as version 8 or version 9. Under Core, select the tar.gz file.
Download the tar.gz file. macOS / Mac OS X will probably extract the file to a .tar file in your
downloads directory. Move this .tar file to a location on your computer where you would like tomcat.
For purposes of this guide, the location will be /Users/user. Double-click the tar to extract it. This
should create a directory in /Users/user named something like apache-tomcat . . . Rename this to
something simple like tomcat. At this point, you should have the following directory on your machine:
/Users/user/tomcat
There is a file called startup.sh located in the the /Users/user/tomcat/bin directory that needs edited.
Open EditRocket and open startup.sh Add the following two lines after the line in startup.sh
that starts with EXECUATBLE. Note that for Snow Leopard, you can use 1.6 instead of 1.5 after the Versions
text in the first line listed below.
export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/1.5/Home
export CATALINA_HOME=/Users/user/tomcat
To start Tomcat, open up a Terminal window (Applications -> Utilities -> Terminal).
cd to the tomcat bin directory by typing the following:
cd /Users/user/tomcat/bin
Type the following:
sh startup.sh
This will start Tomcat. To shutdown tomcat, type sh shutdown.sh
To test the tomcat installation, enter the following in your web browser:
http://localhost:8080/
If the apache tomcat page shows up, the installation was successful.
There is a sample web application called jsp-examples located in the
webapps
directory under the tomcat installation directory. This location can be used to test your own JSP pages,
or you can use the files
contained in this directory
as a template for creating your own web application.
The jsp-examples can be accessed in your web browser using the following URL: http://localhost:8080/jsp-examples/