0

My application should be started automatically after installation using javaw command start .\jre\bin\javaw.exe -arguments

I put it in a batch file, converted it into an exe file and executed it using CustomAction. So far everything went well.

Now I want to forcefully close my application during an upgrade. I've tried using WixQuietExecCmdLine, but it didn't work. Installation ended prematurely.

<Property Id="WixQuietExecCmdLine" Value="&quot;tskill&quot; javaw" />
<CustomAction Id="KillApplication" BinaryKey="WixCA" DllEntry="WixQuietExec" Execute="immediate" Return="check" />

I tried creating an exe file and used it in the CustomAction, but it didn't work either - the FileInUse Dialog still appeared.

<CustomAction Id="KillApplication" Execute="immediate" Return="check" FileKey="filCDFC9A9027274B4FA114589D92028E9A" ExeCommand="" />
<CustomAction Id="LaunchApplication" Execute="immediate" Return="ignore" FileKey="filBBC4F081C914C916EC5A94F19584D53E" ExeCommand="" />

<InstallExecuteSequence>
    <Custom Action="KillApplication" After="InstallValidate">WIX_UPGRADE_DETECTED</Custom>
    <Custom Action="LaunchApplication" After="InstallFinalize">NOT Installed AND NOT UPGRADINGPRODUCTCODE</Custom>
</InstallExecuteSequence>

The log file says, KillApplication was being executed, but my app was still running.

Did I miss something? I use Wix 3.11.

springrolls
  • 1,323
  • 1
  • 14
  • 40
  • I haven't worked with Java in ages, but with that said: [CloseApplication](https://stackoverflow.com/a/39213101/129130). Also, there is a feature called [RestartManager](https://stackoverflow.com/a/48842663/129130) which is supposed to allow an application to shut itself down gracefully "when asked to". I am not sure how this works for Java apps - perhaps there is standard code you can use? Also, here is [a messy summary of alternative approaches for application shutdown during corporate deployment](https://stackoverflow.com/a/50935008/129130) (not quite what you asked). – Stein Åsmul Feb 09 '22 at 15:13
  • Do all Java applications run as javaw.exe? How do you know which one to kill? As you understand my Java knowledge is very faded - years since I dealt with it. – Stein Åsmul Feb 09 '22 at 15:16

0 Answers0