问题
I'm working on a graphic installer for a java project using izPack 4.3.4, the installation goes well but when I try to uninstall it by clicking on his reference in "Programs and Features" window it shows the message:
Error: Unable to access jarfile C:\Program Files (x86)\myproject\uninstaller\uninstaller.jar
The fact is that I choosed to put and rename the uninstaller in the root install path of my program and not in \uninstaller dir. See the XML:
<info>
...
<uninstaller name="uninstall.jar" write="yes" path="${INSTALL_PATH}" />
...
</info>
And, in fact, uninstall.jar file is created in C:\Program Files (x86)\myproject\ and it works if I double click on it or throught the Start Menu. I think izpacks writes the wrong data in the Windows's registry to reference it in "Programs and Features"... but I don't know why...
回答1:
If you're installing using IZPack on Windows, you can (should) have a RegistrySpec.xml. That guy writes all the registry entries you need. Windows looks for a Registry Value "UninstallString" as the file to run to kick off your uninstall, and you likely need to overwrite that. For example on mine:
<pack name="UninstallStuff">
<!-- Special "pack", if not defined an uninstall key will be generated automatically -->
<value name="UninstallString"
keypath="SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$APP_NAME"
root="HKLM"
string="$INSTALL_PATH\uninstall\uninstaller.cmd"/>
<pack name="UninstallStuff">
来源:https://stackoverflow.com/questions/7412783/izpack-creates-an-uninstaller-that-doesnt-work-in-windows-programs-and-feature