how to halt installanywhere installer process if intended target application already running

StackOverflow https://stackoverflow.com/questions/20668928

  •  19-09-2022
  •  | 
  •  

We deploy a Java application using InstallAnywhere 2012.

The deployed application has a version notification mechanism, which pops up a website, and encourages the user to download and launch "new version" while the "old version" may still be running. There is a "please exit" dialog during this process but the users usually don't exit, and the act of installing "new version" typically only overwrites files which were not locked, which yields a non-working installation until the user does a clean re-install.

I'd like to modify the actual installer to bail if "old version" is currently running, asking the user to quit it first.

IA offers a way to "execute custom code" which can be pointed to a jar file. So I created a standalone runnable jar program that exits with code 0 if all is clear, or code 1 if "old version" is detected as running, relying on tasklist.exe's return and some string parsing. However, I can't seem to find a way to alter the course of the installer based on my program's output.

Has anyone else tried doing this in IA platform, and if successful, how did you go about it?

有帮助吗?

解决方案

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..

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top