Did this blog help you solve a problem? Tip me with Bitcoins at: 17dQktcAmU4urXz7tGk2sbuiCqykm3WLs6

Sunday, November 8, 2009

Installing and Running Tomcat on Mac OS X

Using MySQL and Java? Check out an easier way: Yank

Installing Tomcat on Mac OS X should be easy, and it is, if you follow these instructions exactly.


Step 1: Get Tomcat. Go to tomcat.apache.org and download the version of Tomcat you need. Download the "Core" distribution with the tar.gz extension and unzip it (double-click the file).

Step 2: Install Tomcat. Move the contents of the unzipped file to /Library/Tomcat, creating the folder "Tomcat" in "Library" if it is not there already. That's it. Tomcat is installed.



Step 3: Fire up the terminal.



Step 4: Start Tomcat.

# sh /Library/Tomcat/bin/startup.sh

Step 5: Test if it worked. Use your browser to go to: http://127.0.0.1:8080/ You should see the default Tomcat homepage running from your newly installed Tomcat server.


Step 6: Shutdown Tomcat:

# sh /Library/Tomcat/bin/shutdown.sh

Optional steps to deploy a sample .war file!

Step 7: Point your browser to: http://127.0.0.1:8080/docs/appdev/sample/

Step 8: Download the sample .war file found on the above page and place it in /Library/Tomcat/webapps. Tomcat will recognize and load the .war file.

Step 9: Point your browser to: http://localhost:8080/sample/ to view the sample webapp.



By the way, Tomcat can be found in the Activity Monitor with the name "java". If Tomcat ever hangs and you need to kill the process, just use Activity Monitor to do so.


Piece of Cake!!


See also: MacBook Hard Drive Upgrade Instructions
And also: Install MySQL on Mac OS X

3 comments:

Vijay said...

Great post for beginners!! Thanks..

alekastyl said...

when i command the sudo ./startup.sh it asks me for password what should i type?

Tim Molter said...

alekastyl, It's asking you for the password because you used the sudo command, which I mistakenly had in the article. You should not need sudo and hence the computer admin's password. I took that out of the article.