Install4j - autoupdate from 'external launcher' - install4j

Is there any way how to put autoupdate feature working with 'external launcher' or with installer without laucnher? Or autoupdate feature works with 'generated launcher' only?

While you can call the update downloader from an external launcher, the update downloader has no way to shut down the launcher in case it needs to execute an update installer.

Related

install4j: Unattended auto-update and relaunch at end

So I'm trying to build an auto-updater for my app. I've chosen the "Update downloader with silent version check". It's integrated with my launcher as well, like it can be seen in the first picture. I'd like if possible to remove the screen where the user is asked whether to launch the updater and just always execute it.
launcher integration
Screen to remove
My client would also like to have the auto-update process as unattended as possible. So it would need the following steps:
1) user starts launcher
2) auto-updater checks and finds new version
3) auto-updater downloads new version
4) auto-updater launches downloaded updater
5) auto-updater finishes and relaunches new version of the app
I've managed the first 4 steps but I can't manage to make it relaunch the app, or at least have an informative message saying that the user needs to relaunch it him/herself. I've added the Execute launcher action but it seems to either not launch or launch the previous version. Is there a tutorial or anything for this at it seems like my case is pretty standard? :(
Any help would be appreciated, as I've been struggling with this for a while.
Thanks
The background update functionality in install4j (since 7.0) is more suitable for your use case.
See
https://www.ej-technologies.com/products/install4j/whatsnew7.html
and search for "Background auto-update" to see screen shots.
To get started, add a "Background update downloader" application on the Installer->Screen & Actions step.
In the launcher wizard of a GUI launcher that should process scheduled update installers, go to the new "Auto-update integration" step and select the "Execute downloaded update installers at startup" check box. By default, the execution mode is set to "Unattended mode with progress dialog".
For services and command line launchers, the UpdateChecker API allows you to execute scheduled update installers programatically.
You can also execute the downloaded installer as soon as it's downloaded. The source file
samples/hello/gui/HelloGui.java
shows you how to interact with the background updater by using the API.

How can the auto updater wait for an event from the launcher executable?

I am using an updater application (without version check) in unattended mode, but I need the updater to wait for an event from the launcher executable before continuing to execute the installer.
The event will typically be a user confirmation that the downloaded installer can be executed. I would prefer that the launcher executable prompt the user to update, once it knows that the downloaded installer is ready.
Is there another way to solve the problem?
There is no such communication mechanism as of install4j 6.1.
I would recommend to change your updater application so that it does not execute the installer but just writes it to a particular directory. After it has finished you can check if an executable exists in the directory and ask if it should be executed. If the user confirms the update, you then invoke another custom installer application that only contains the "Run executable" action from the original updater template.

Install4j: Wait for a launcher to finish

In Install4j, I need to call my application to do initialization within the installer. I use a launcher for that, because it automatically uses the correct JRE and is almost the same as the launcher that will start the application as a service.
I found the 'Execute Launcher' action, but that does not wait after invoking. How can I wait for the launcher to finish?
In that case, you have to use the "Run executable or batch file" action and select the "Wait for termination" property.

How to avoid application start after cancel auto update on startup?

Today I need help to deactivate the auto startup of the main application after I abort the update process. The update is triggert automatically during startup so I used the "silent version check" template. But I can't find any option to deactivate the automatic startup.
It is necessary to update the version if there is any newer then the installed one before starting the main application.
I am using version 5.1.5.
Thanks in advance
Hardie
If your requirements are more complex, you cannot use the automatic launcher integration. On the launcher integration tab of the updater, click on "Start integration wizard". The wizard will give you a code snippet that you can invoke in the main method of your application in order to start the updater.
Surround that code snippet with
if (UpdateChecker.getUpdateDescriptor(UPDATE_URL,
ApplicationDisplayMode.GUI).getPossibleUpdateEntry() != null) {
// code snippet from the integration wizard to launch the updater
}
so that the updater is only invoked if an update is available. Then, if you do not receive a call to prepareShutdown, you can display a warning and close the application.

Install4j add on update installer within main installer

Is it possible to bundle an add on update installer within a main installer and detect if there is a previous version present on the machine = run the add on update installer else run the main installation?
I don't think it would make a lot of sense to bundle a separate update installer. Also, an add-on installer cannot perform an update since it cannot change the installed version.
Installers know if they are performing an update or not and you can change their behavior based on that condition.
For example, in order to not execute a particular action for an update, set its condition expression to
!context.isUpdateInstallation()
If you have complex update-dependent logic for file installations, you can handle that in the "File filter" property of the "Install files" action.