Well if so, I have a problem. I have created an uninstaller which gets placed in the installation directory (created using an antinstaller installer) during install. But during uninstall, the uninstaller.jar doesn't get deleted since it's running. Anyway to get around this. I don't want the uninstaller.jar to be placed anywhere outside of the home installation directory.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I suppose you're using Windows, right? Well, in this case you'll have to modify Windows (or use some low level trick that I don't know of). One of the great UNIX inventions was "file reference counting": a file is kept in existence as long as there exists a reference to it, either by having it linked in a directory on the file system or by having an open file descriptor. This allows open files to be deleted.
AFAIK there is no equivalent in Windows. Rather, Windows locks open files, thus preventing you from deleting or renaming it. This is one of the reasons why you have to reboot Windows even after minor updates ("To finish the installation, you have to reboot"): the installation (or uninstallation) creates a script that is executed on boot before the crucial files are locked.
I think there is no way around this in Windows. If you want an uninstaller that cleans up itself, you have to create such a script that will eventually remove the uninstaller.jar on the next boot.
Note that this explanation is based on my experiences. I'm not a Windows-Installer expert.
- Michael
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
First if you fancy writing Java check the extension mechanism ReleaseNotesFilter.java provides an example that pops up release notes. you can do anything in Java there, including runnign a script.
Obviously you can do the same in Ant just add a target at the end that depends on some property you set on success of the build component. That is the best mechanism for just runnign a script.
AI is open source, so if you want to build into the code you could add something to the private void addShutdownHook(final File tempDir) method in ExecInstall.java this will be fired even if the user tries to shutdown the window without hitting the finish button. You can check the context (ctx) to see if the install succeded.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Well if so, I have a problem. I have created an uninstaller which gets placed in the installation directory (created using an antinstaller installer) during install. But during uninstall, the uninstaller.jar doesn't get deleted since it's running. Anyway to get around this. I don't want the uninstaller.jar to be placed anywhere outside of the home installation directory.
I suppose you're using Windows, right? Well, in this case you'll have to modify Windows (or use some low level trick that I don't know of). One of the great UNIX inventions was "file reference counting": a file is kept in existence as long as there exists a reference to it, either by having it linked in a directory on the file system or by having an open file descriptor. This allows open files to be deleted.
AFAIK there is no equivalent in Windows. Rather, Windows locks open files, thus preventing you from deleting or renaming it. This is one of the reasons why you have to reboot Windows even after minor updates ("To finish the installation, you have to reboot"): the installation (or uninstallation) creates a script that is executed on boot before the crucial files are locked.
I think there is no way around this in Windows. If you want an uninstaller that cleans up itself, you have to create such a script that will eventually remove the uninstaller.jar on the next boot.
Note that this explanation is based on my experiences. I'm not a Windows-Installer expert.
- Michael
Is there a way to launch a script on exiting the installer (provided the install/uninstall has run successfully).
There are a couple of ways.
First if you fancy writing Java check the extension mechanism ReleaseNotesFilter.java provides an example that pops up release notes. you can do anything in Java there, including runnign a script.
Obviously you can do the same in Ant just add a target at the end that depends on some property you set on success of the build component. That is the best mechanism for just runnign a script.
AI is open source, so if you want to build into the code you could add something to the private void addShutdownHook(final File tempDir) method in ExecInstall.java this will be fired even if the user tries to shutdown the window without hitting the finish button. You can check the context (ctx) to see if the install succeded.