Cannot start a service after "Install a service" action in Install4j - install4j

Until now, we installed and started out services with "Run executable or batch file" action and it worked fine.
I want to switch these actions with new "Install/start/stop a service" respectively actions, so I tried doing it with moderate steps - first switching the 1st executable install action with "Install a service" action.
It seems the installer do install the service but it won't start it. when I try to manually start it - I'm getting the error:
error 1053 the service did not respond to the start or control request in a timely fashion
I doubled checked myself & both old executable action and the new "Install a service" action are configured the same, while the only different between them, is that on the executable action I also configured the "Wait for termination" property along with the "wait for output streams" property.
Is my problem stems from that difference, and if so, is there any way configuring the new action as well?

Related

Eclipse Launch Group: Stop if single launch configuration fails

We are having Maven projects relying on each other, which are built separately and included as dependencies. So to have a single button to compile all the intermediate steps, I use Eclipse Launch Groups. However when a single build fails, the Launch Group just goes on, which can be unrecognizable unless you control every single console instance.
Is there a way to stop the execution if a single step fails? Maybe Launch Groups are not the perfect fit and there is another tool for multiple Run Configuration executions?
By try-and-error I found the following solution, which works for our Maven builds: Chose as "Post launch action" "Wait for console output", and let it wait for "[INFO] BUILD SUCCESS". This pauses the execution of the launch group at the failed process, pointing you directly to the first occured error.
If you use other build setups or tools you have to check which string gets exclusively printed on build success.

Can I set a variable in the build time before the installation process in Install4j?

For each installation I would like to introduce the current version on the welcome screen. For that, I create a "Read a properties file" action which reads my application manifest.properties which exists under the distribution tree. A step later I have a "Run script" action which extracts the properties I need for the version and set it into installer variables.
My problem is that when trying to install the installer on a clean computer it throws an error since it has no distribution tree nor the manifest.properties.
Is there any elegant way to set the variables before the installation process begins, like in the build time for example?
The version of your application is configured on the "General Settings->Application Info" step. You can use it in all text properties with this syntax:
${compiler:sys.version}

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 to prevent an addon installer from installation when main application is missing?

Today I have a question about the addon installation medium. We have to create an installer which installs some tools to extend the main application. Therefore I created a project and configured it as an addon installer. Therefore I set the application ID from the main application to the addon configuration. Then I expected that the installer checks whether the main app is installed or not. I also avoid to bundle the jre so the installer should use the jre from the main application. When I try to install the addons the installer ask for a suitable jre and then starts to install the component. I expected an error message and the installation to be aborted. Maybe I missed some configuration?
You can call
ApplicationRegistry.checkApplicationId(context.getInstallationDirectory())
in a "Run script" action in add-on installer to check whether a main installer installation has been found. If the above returns false, you can return false from the script, set the "Failure strategy" property to "Quit on failure" and the "Error message" property to the error message that you wish to display.

Download and install additional application with Install4J

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