Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Are there special requirements for invoking Java in a script controlled by launchd?



I'm still having daemon issues, but a different problem from what I posted in a recent thread. I have a shell script that invokes my java app, using

java -cp my/classpath path/to/my/app

The shell script is launched by launchd with user scope, by putting a plist file in ~/Library/LaunchAgents. The script and java app launch properly. However, my reason for using launchd is that I want to have the app running in the background but also give the user the capability to select an action that will stop it. But I can't get launchd to stop the java app, and I think it may be because of the way I'm invoking it in the script..

From Terminal, I see the launchd item as expected via "launchctl list". And when I enter

           launchctl stop the.process.id

The command returns normally in Terminal, and in the Console I see a launchd message that the item terminated. The problem is the app is still running. If I try

          launchctl start the.process.id

launchd reports that it's not running. If I start the daemon again via launchd, I get a second instance of the app running.

Is it because launchd is only controlling the script execution, but the Java app is running on its own? I thought that since I didn't use "exec java..." this wouldn't be the case. I have OnDemand set to "yes" in the plist file, and the plist file, script, and app are owned by the logged in user (permission = rwx), with group and other set to not writable, per the required configuration for launchd items as given in the apple documentation.

-Mark

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.