Tuesday, May 31, 2011

Mac OS X Java launchd (inetd) Applications

While I was creating my daemon examples for my previous blog entry, I created a plist file for executing launchd based applications. The convention is to name the plist file to match the name of the main application. In this example, it is com.bluelotussoftware.examples.Daemon. Place the file int the ~/Library/LaunchAgents directory.
Here is the file: com.bluelotussoftware.examples.Daemon

com.bluelotussoftware.examples.Daemon


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC -//Apple Computer//DTD PLIST 1.0//EN
http://www.apple.com/DTDs/PropertyList-1.0.dtd >
<plist version="1.0">
    <dict>
        <key>Label</key>
        <string>com.bluelotussoftware.examples.Daemon</string>
        <!-- Program key is not necessary for Java -->
        <!--
        <key>Program</key>
        <string>/usr/bin/java</string>
        -->
        <key>ProgramArguments</key>
        <array>
            <string>/usr/bin/java</string>
            <string>-jar</string>
            <!-- MODIFY THIS TO POINT TO YOUR EXECUTABLE JAR FILE -->
            <string>/Users/jyeary/Desktop/JavaDaemonExample.jar</string>
        </array>
        <key>OnDemand</key>
        <true/>
        <key>RunAtLoad</key>
        <false/>
        <key>KeepAlive</key>
        <false/>
        <!-- MODIFY FOR YOUR ENVIRONMENT -->
        <key>StandardErrorPath</key>
        <string>/Users/jyeary/Desktop/err.log</string>
        <key>StandardOutPath</key>
        <string>/Users/jyeary/Desktop/out.log</string>
        <key>WorkingDirectory</key>
        <string>/Users/jyeary/Desktop</string>
    </dict>
</plist>

0 comments :

Popular Posts