Launchd is the preferred way in OS X.
If you want it to run in your login, put it in ~/Library/LaunchAgents
Start Launchd item
launchctl load /Library/LaunchDaemons/com.bob.plist
Stop item
launchctl unload /Library/LaunchDaemons/com.bob.plist
Example com.bob.plist
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>Label</key> <string>com.bob</string> <key>RunAtLoad</key> <true/> <key>ProgramArguments</key> <array> <string>/usr/bin/java</string> <string>-jar</string> <string>/Users/user/program.jar</string> </array> </dict> </plist>
Milhous Sep 19 '08 at 14:06 2008-09-19 14:06
source share