7

I'm using Install4J to build an installation for my application (lets call it MainApp), and it work great.

To be able to use MainApp, you also need to install my second application (lets call this one SecondApp).

My question is this. Is there a way to get Install4J to first install MainApp, and as the last step in the installation download SecondApp (an exe file located on a webserver) and execute it?

ulejon
  • 601
  • 4
  • 21

1 Answers1

8

You can do that by adding two actions to the "Installation" screen:

  • "Download file" action, for downloading the "SecondApp" installer

  • "Run executable or batch file" action, for executing it. Select the "Wait for termination" property to wait for the installer to complete.

To improve user feedback add the following two actions to before the "Run executable or batch file" action:

  • "Set the progress bar" action with "Type of change" set to "Set to indeterminate state"

  • "Set messages" action with "Use status" selected and "Status message" set to "Installing second app ..."

If you do not want to keep the "SecondApp" installer executable, use ${installer:sys.workingDir}/secondapp.exe to download it to the temporary directory of the installer. It will be deleted automatically when the installer exits.

Ingo Kegel
  • 42,759
  • 9
  • 65
  • 97
  • I can't seem to get this to work. Install4j actually crashes repeatedly as I try to set this up, but the process for making the SecondApp installer a downloadable component is not clear to me. I understand you can mark it as such under "Installation Components->Options" and that you should be able to specify the URL to download it from under "Media->Data Files->downloadable" but I can 't get that to work. Has this changed since you answered it? – adamfisk Jun 05 '13 at 01:40
  • @adamfisk No, it's still the same. Please contact support, also send us details about the crashes. – Ingo Kegel Jun 05 '13 at 07:36
  • @IngoKegel OK figured out the top level issue -- I was using the "Download and install component" action and missed the straight "Download file" action under update. That said, though, the "Download file" action continually gets interrupted for me for no apparent reason. This also doesn't seem to support HTTPS? The latter is definitely a deal breaker for us, as it should be for almost any installer really. I get continually interrupted downloading the following: http://s3.amazonaws.com/lantern/lantern-0.21.3-9-ff18154.dmg – adamfisk Jun 06 '13 at 22:35
  • OK - got it working. The download file action interrupts continually after downloading about 5MB looking at the TCP streams in Wireshark. If you uncheck "Retry if interrupted" under the Download file action config, it stops getting interrupted and seems to work! – adamfisk Jun 06 '13 at 23:26
  • @adamfisk That is really strange, that setting only has an effect if an exception is thrown during the download. One thing you could change is the the read timeout, which is set at 10 seconds by default. If you set the VM parameter -Dinstall4j.readTimeout=0 in the installer (this is in ms), there will be no timeout. – Ingo Kegel Jun 07 '13 at 07:35