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:

  1. Extracts the jar to a temporary directory
  2. Spawns a new process for Phase 2, referencing the temporary directory as the classpath; and
  3. Exits

Its invoked by running:

    java -jar MyApp/Uninstaller/uninstaller.jar

To debug this phase:

  1. Place a breakpoint in com.izforge.izpack.uninstaller.Uninstaller.main(String[] args)
  2. Run the command with the appropriate debug agent settings
  3. 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:

  1. Spawns a new process for Phase 3
  2. Waits for it to complete
  3. Deletes the temporary directory containing the classes extracted in Phase 1

To debug this phase,:

  1. Place a breakpoint in  com.izforge.izpack.util.SelfModifier.main(String[] args)
  2. Define the self.mod.debugPort2 property, which specifies the debug port to listen on
  3. 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:

  1. Place a breakpoint in  com.izforge.izpack.util.SelfModifier.main(String[] args)
  2. Define the self.mod.debugPort3 property, which specifies the debug port to listen on
  3. 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