javainstall4j

Why would install4j leave some installed files behind when updating existing installation?


We are using install4j v8.0.11. A normal installation works correctly and a normal uninstallation also works correctly by deleting all files from C:\Program Files (x86)\App\lib as expected.

However, when the application is already installed and we run a newer version of the installation and choose to update the existing installation then some of the Java dependencies (files in the lib folder that make up the CLASSPATH) are not deleted during the uninstallation phase. This causes multiple files of the same dependency to be on the CLASSPATH which can result in Java using the wrong (older) version of a class.

What could be causing some of the the files in lib to not be deleted? (most files are deleted)

What have we tried?

We have actions in place to stop the running application and the running service as part of the installation phase as well as the uninstallation phase.

enter image description here

The failure strategy for the Execute previous uninstaller and Uninstall files actions are configured to Ask user whether to retry or quit on failure, but we don't get any prompts.

Installation logs

[INFO] com.install4j.runtime.beans.actions.InstallFilesAction [ID 9]: Execute action
       Property directoryResolverScript: null
       Property fileFilterScript: null
       Property sizeCalculatorScript: null
       Property acceptAllCertificates: false
       Property checkFreeSpace: true
       Property delay: false
       Property installRuntime: true
       Property rollbackSupported: true
       Property saveDownloadedFiles: false
       Property showFileNames: true
       Property triggerReboot: true
       Property updateBundledJre: true
       Property validateApplicationId: false
...
       Install file: C:\Program Files (x86)\App\lib\delight-nashorn-sandbox-0.1.14.jar; size: 75435 bytes; exists: false
       Install file: C:\Program Files (x86)\App\lib\application-1.0.0.25194.jar; size: 1264714 bytes; exists: false
       Install file: C:\Program Files (x86)\App\lib\commons-1.0.0.25194.jar; size: 995 bytes; exists: false
       Install file: C:\Program Files (x86)\App\lib\error_prone_annotations-2.0.18.jar; size: 3632 bytes; exists: false
       Install file: C:\Program Files (x86)\App\lib\flyway-core-6.5.7.jar; size: 293620 bytes; exists: false
...
       Execute action successful after 41010 ms

Update installation logs

[INFO] com.install4j.runtime.beans.screens.WelcomeScreen [ID 2]: Show screen
[INFO] checking writable with maximum
[INFO] Variable changed: sys.confirmedUpdateInstallation=true[class java.lang.Boolean]
...
[INFO] com.install4j.runtime.beans.actions.InstallFilesAction [ID 9]: Execute action
       Property directoryResolverScript: null
       Property fileFilterScript: null
       Property sizeCalculatorScript: null
       Property acceptAllCertificates: false
       Property checkFreeSpace: true
       Property delay: false
       Property installRuntime: true
       Property rollbackSupported: true
       Property saveDownloadedFiles: false
       Property showFileNames: true
       Property triggerReboot: true
       Property updateBundledJre: true
       Property validateApplicationId: false
...
       Install file: C:\Program Files (x86)\App\lib\delight-nashorn-sandbox-0.1.14.jar; size: 75435 bytes; exists: true
       File times: 1669725278000, 1669618416000
       Install file: C:\Program Files (x86)\App\lib\application-1.0.0.25203.jar; size: 1266730 bytes; exists: false
       Install file: C:\Program Files (x86)\App\lib\commons-1.0.0.25203.jar; size: 995 bytes; exists: false
       Install file: C:\Program Files (x86)\App\lib\error_prone_annotations-2.0.18.jar; size: 3632 bytes; exists: true
       File times: 1669725278000, 1669618416000
       Install file: C:\Program Files (x86)\App\lib\flyway-core-6.5.7.jar; size: 293620 bytes; exists: true
       File times: 1669725278000, 1669618416000
...
       Execute action successful after 48259 ms

The update installation copies new versions of the application and commons JARs, but it doesn't delete the previous/old versions. Also, looking at the update installation's log files I don't see any actions being run to either run the previous uninstaller or uninstall any files.

What do we expect?

We expect all files to be deleted from the lib folder when updating an existing installation just as they would be deleted when uninstalling normally.


Solution

  • We expect all files to be deleted from the lib folder when updating an existing installation

    This will only happen if you add an "Execute previous uninstaller" action to the "Installation" screen.

    The uninstaller that is executed by that action saves its log file to the file

    <installation directory>/.install4j/uninstallPrevious.log