install4j 自动更新启动器集成命令行参数

install4j auto update launcher integration command-line arguments

我在 MacOS 10.12 上使用 Install4j 的 6.1.3 评估版,我想从我的应用程序中启动带有静默版本检查的自动更新程序,并为 updates.xml 传递 URL作为启动器集成参数。

我使用启动器集成向导创建了这段代码:

// This will return immediately if you call it from the EDT,
// otherwise it will block until the installer application exits
ApplicationLauncher.launchApplicationInProcess("9248", new String[] {"-DmyUpdateURL=" + MY_UPDATE_URL}, new ApplicationLauncher.Callback() {
    public void exited(int exitValue) {
        //TODO add your code here (not invoked on event dispatch thread)
    }

    public void prepareShutdown() {
        //TODO add your code here (not invoked on event dispatch thread)
    }
}, ApplicationLauncher.WindowMode.FRAME, null

);

我想在自动更新选项 -> URL 中为 updates.xml 字段使用 myUpdateURL。我如何从 Install4J 中引用 myUpdateURL?或者如果我做错了,如何通过启动器集成将 updates.xml 的 URL 传递给自动更新程序?

提前致谢!

I would like to use myUpdateURL in Auto-Update Options -> URL for updates.xml field.

这是不可能的,因为该信息在编译时是固定的。您必须在运行时更改该信息的使用站点,在那里您可以使用安装程序变量。

请按照以下步骤操作:

  1. 在 Installer->Screens & Actions 下,select 更新应用程序并预​​定义一个安装程序变量 myUpdateURL,类型为字符串,值为 ${compiler:sys.updatesUrl}

  2. 在更新应用程序中找到 "Check for update" 操作并将 "Update descriptor URL" 属性 的值更改为 ${installer:myUpdateURL}(您可以使用安装程序变量 select 或者这样做)

  3. 使用参数 "-VmyUpdateURL=" + MY_UPDATE_URL

  4. 启动更新程序