4

我有以下启动配置(存储在 中acme.plist),我分别加载并开始使用launchctl load acme.plistlaunchctl start acme.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.acme</string>

    <key>ProgramArguments</key>
    <array>
        <string>/usr/bin/java</string>
        <string>-jar /usr/local/acme/acme-latest.jar</string>
    </array>

    <key>StandardErrorPath</key>
    <string>/tmp/acme-error</string>
</dict>
</plist>

每当我尝试运行它时,我都会得到以下信息/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.

然而,从 bash 运行时我绝对没有问题。有任何想法吗?

4

1 回答 1

7

您应该像这样更改配置:

<key>ProgramArguments</key>
<array>
    <string>/usr/bin/java</string>
    <string>-jar</string>
    <string>/usr/local/acme/acme-latest.jar</string>
</array>
于 2015-10-03T22:17:41.870 回答