I have the following launchd configuration (stored in acme.plist) which I load and start using launchctl load acme.plist and launchctl start acme.plist respectively.
Label
com.acme
ProgramArguments
/usr/bin/java
-jar /usr/local/acme/acme-latest.jar
StandardErrorPath
/tmp/acme-error
Whenever I try to run it, I get the following in /tmp/acme-error:
Unrecognized option: -jar /usr/local/acme/acme-latest.jar
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
Yet I have absolutely no problems when running from bash. Any ideas?
解决方案
You should change your config like so:
ProgramArguments
/usr/bin/java
-jar
/usr/local/acme/acme-latest.jar