1

我们使用 InstallAnywhere 2012 部署 Java 应用程序。

部署的应用程序有版本通知机制,弹出一个网站,鼓励用户下载并启动“新版本”,而“旧版本”可能仍在运行。在此过程中有一个“请退出”对话框,但用户通常不会退出,并且安装“新版本”的行为通常只会覆盖未锁定的文件,这会导致安装无法正常工作,直到用户执行干净重新安装。

如果“旧版本”当前正在运行,我想修改实际的安装程序以保释,要求用户先退出它。

IA 提供了一种“执行自定义代码”的方法,该方法可以指向一个 jar 文件。因此,我创建了一个独立的可运行 jar 程序,如果一切正常,则退出代码 0,如果检测到“旧版本”正在运行,则退出代码 1,这依赖于 tasklist.exe 的返回和一些字符串解析。但是,我似乎找不到根据我的程序输出更改安装程序过程的方法。

有没有其他人尝试在 IA 平台上这样做,如果成功,你是怎么做的?

4

1 回答 1

2

Configure a custom code action . Keep the following as reference.

public class PreviousVersionCheck extends CustomActionBase{

    @Override
    public void install(InstallerProxy proxy) throws InstallException {

     boolean oldVersionRunning = isOldVersionRunning();//Logic to check if old version running.
     proxy.setVariable("$OLD_VERSION_RUNNING$",oldVersionRunning)
 }
}

After the custom code action , add a "Show Message Dialoge" . Add the rule for the action as
$OLD_VERSION_RUNNING$ equals true

In the action properties, you have cancel and exit option,on click of dialouge Button..

Hope this helps..

于 2014-02-17T08:50:46.830 回答