0

我想对 Install4J 包装的应用程序执行以下操作:

  • 从包装的 Java 应用程序的代码中调用 Install4J 更新程序
  • 如果有可用更新,则向用户显示在 Install4J IDE 中配置的 GUI 对话框
  • 如果需要,将自定义代理参数传递给更新程序

据我所知,Install4J 我应该能够通过以下方式做到这一点:

List<String> args = new ArrayList<String>();
args.add("-DproxySet=true");
args.add("-DproxyHost="+MY_PROXY_SERVER);
args.add("-DproxyPort="+MY_PROXY_PORT););
args.add("-DproxyAuth=true");
args.add("-DproxyAuthUser="+MY_PROXY_USERNAME);)
args.add("-DproxyAuthPassword="+MY_PROXY_PASSWORD);

ApplicationLauncher.launchApplicationInProcess(
    MY_UPDATER_ID.toString(), 
    args.toArray(new String[args.size()]),
    null, 
    ApplicationLauncher.WindowMode.FRAME, 
    null);

但我不断收到用于输入代理详细信息的弹出窗口。

我尝试将参数更改为没有前缀“-D”,尝试将 Updater 切换到控制台模式或无人值守模式,不传递参数,而是使用 System.setProperty() 直接将它们放入 JVM ......但没有成功。我总是以代理弹出窗口或消息“无法从_ __ _下载更新信息请检查您的网络设置”结束。

另外:如果我重复调用 Updater 但使用不同的参数,弹出窗口总是显示我用于第一次调用的一次。

有什么帮助吗?提前致谢。

4

1 回答 1

0

Thanks to the support from EJ-tehnologies (developers of Install4J) we got the proxy thing working. In the moment of asking the question we were using v5.0.11, and they instructed us to use v5.1.2 (latest stable build in that moment). And finally we ended using the beta release v5.1.3 (not publicly available at the moment).

Details on how to have proxy working, without popup and with using dynamic parameters:

  • to the code above add additional argument that will prevent Install4J to detect system wide proxy settings:

    args.add("-Dinstall4j.noProxyAutoDetect=true");
    
  • use method ApplicationLauncher.launchApplication() for invoking the Install4J wrapper as it will start it in the new JVM. starting like this is required due to JVM's handling of existing env variables, so if you start Install4J in the same JVM and append arguments in that JVM the Install4J might not pick the latest values (this is if you want to dynamically change proxy params)

  • wait for v5.1.3 to become stable and download it as it will support "not showing" of proxy popup dialog when proxy parameters are explicitly given to Install4J (this is my guess, I'm not speaking in the name of people from EJ-technologies)

于 2012-08-03T15:13:44.763 回答