Serving Java with MAMP
This is gleaned from here.
To get Java code to run locally in conjuction with MAMP follow these steps:
- Download the latest tomcat binary from here.
- Extract and place in your MAMP folder (usually in your application folder).
- Rename the tomcat folder (apache-tomcat-X.X.XX) to tomcat (this is just to ease upgrades I think).
- Add “
/Applications/MAMP/tomcat/bin/startup.sh
” to the end of the file/Applications/MAMP/bin/startApache.sh
- Add “
/Applications/MAMP/tomcat/bin/shutdown.sh
” to the end of the file/Applications/MAMP/bin/stopApache.sh
- Finally, change the permissions on the following files:
chmod +x startup.sh
chmod +x shutdown.sh
chmod +x catalina.sh
chmod +x setclasspath.sh
chmod +x bootstrap.jar
chmod +x tomcat-juli.jar
The lines in step 4 and 5 could be added to the overall ‘start.sh’ and ‘stop.sh’ but as it requires(?) Apache it doesn’t make sense to have tomcat as a self-contained entity.
Fire up a browser and head to localhost:8080
to see if all that worked.
Here is a script to do steps 4 to 6:
#!/bin/sh echo "/Applications/MAMP/tomcat/bin/startup.sh" >> /Applications/MAMP/bin/startApache.sh echo "/Applications/MAMP/tomcat/bin/shutdown.sh" >> /Applications/MAMP/bin/stopApache.sh chmod +x /Applications/MAMP/tomcat/bin/startup.sh chmod +x /Applications/MAMP/tomcat/bin/shutdown.sh chmod +x /Applications/MAMP/tomcat/bin/catalina.sh chmod +x /Applications/MAMP/tomcat/bin/setclasspath.sh chmod +x /Applications/MAMP/tomcat/bin/bootstrap.jar chmod +x /Applications/MAMP/tomcat/bin/tomcat-juli.jar |
Thanks! Awesome!
I love being able to follow installation instructions from a blog post without complications! Worked perfectly, thanks.
(Only difference is you link to Tomcat 7.X.XX and we’re on to 8.X.XX now, but I was able to find my way to the appropriate download page.)
It worked like a charm. Many thanks.
Thanks, this is succinct and clear!
Thanks so much. Quick and simple
very very Awesome!…. tnQ man