Launchd & Tomcat

Launchd is amazing. It's predictable, simple, easy and correct. When Apple makes an app like Launchd in 2005, it makes me wonder what the hell Sun, HP and IBM were doing while improving UNIX for the last 30 years. Regardless it's my new favourite thing and it's much better than init.d and the Windows services system.

To get Tomcat started when your Mac boots, create a file called /Library/LaunchDaemons/org.apache.jakarta.tomcat.plist and fill it with the following XML. You'll need to change the paths to your Tomcat folder and use the Mac OS X user that Tomcat shall run as.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://">
<!-- Tomcat Startup Script, by Jesse Wilson, May 27, 2005 -->
<plist version="1.0">
<key>Label</key> <string>org.apache.jakarta.tomcat</string>
<key>OnDemand</key> <false/>
<key>ProgramArguments</key> <array>
<key>ServiceDescription</key> <string>Tomcat Server</string>
<key>UserName</key> <string>jessewilson</string>
<key>StandardOutPath</key> <string>/Users/jessewilson/Apps/jakarta-tomcat-5.5.9/log.stdout</string>
<key>StandardErrorPath</key> <string>/Users/jessewilson/Apps/jakarta-tomcat-5.5.9/log.stderror</string>
<key>EnvironmentVariables</key> <dict>
God bless Google. And you, too!
You sir are amazin. I'd searched for ages to find a decent way to startup the Tomcat server that comes bundled with NetBeans without having to start NetBeans first and this has conquered that no problem. I did add in a couple more Environment Variables to change the CATALINA_BASE etc but it was a cracking solution for a complete Mac newbie. Thankyou sir!!
This doesn't work properly.

' start' exec starts tomcat asynchronously, so it exits, and luanchd decides to start it again. Have a look at your system log after using this plist.

Another version can be found here: