Debugging Uninstallers
To perform uninstallation, IzPack goes through three phases, each involving a separate process.
The following describes how to remotely debug each of these phases.
Phase 1
This phase:
- Extracts the jar to a temporary directory
- Spawns a new process for Phase 2, referencing the temporary directory as the classpath; and
- Exits
Its invoked by running:
java -jar MyApp/Uninstaller/uninstaller.jar
To debug this phase:
- Place a breakpoint in com.izforge.izpack.uninstaller.Uninstaller.main(String[] args)
- Run the command with the appropriate debug agent settings
- Attach to the process in the debugger
E.g.:
java -jar -Xdebug -Xrunjdwp:transport=dt_shmem,address=jdbconn,server=y,suspend=y MyApp/Uninstaller/uninstaller.jar
Phase 2
This phase:
- Spawns a new process for Phase 3
- Waits for it to complete
- Deletes the temporary directory containing the classes extracted in Phase 1
To debug this phase,:
- Place a breakpoint in com.izforge.izpack.util.SelfModifier.main(String[] args)
- Define the self.mod.debugPort2 property, which specifies the debug port to listen on
- Attach to the process in the debugger using socket transport, and the port above
E.g.:
java -jar -Dself.mod.debugPort2=8002 MyApp/Uninstaller/uninstaller.jar
Phase 3
This phase performs the actual uninstallation.
To debug this phase:
- Place a breakpoint in com.izforge.izpack.util.SelfModifier.main(String[] args)
- Define the self.mod.debugPort3 property, which specifies the debug port to listen on
- Attach to the process in the debugger using socket transport, and the port above
E.g.:
java -jar -Dself.mod.debugPort3=8003 MyApp/Uninstaller/uninstaller.jar