javainstallationwixwindows-installerjpackage

How to store multiple jpackage installations under the same parent directory?


I have several applications that I finally turned into modular jars, and now, I want to package them with jpackage.

Since there are several applications, I want to bundle them all under the same parent directory, let's say parent_directory. I know that I can specify that as --install-dir parent_directory/child_folder for jpackage, according to this tutorial. https://dev.java/learn/jvm/tool/jpackage/

The problem is, if I specify the folder structure as above, then upon uninstallation, not only will child_folder get deleted, but so will parent_directory.

How do I get jpackage to only delete child_folder upon uninstallation?

EDIT - as a side note, I am aware of workarounds such as this -- https://stackoverflow.com/a/67574903/10118965

I am not opposed to doing that, but I would consider that a last resort, and I want to exhaust my options before doing that.


Solution

  • Looks like I jumped the gun.

    As it turns out, Windows is smart enough to recognize that 2 installations share the same parent directory. So, it will only delete parent_directory if there is no other installation at that location.

    The reason I why I thought that it would delete parent_directory is because I tested it with a dummy folder, and then made the (false) assumption that windows would delete the whole parent_directory if there was another install there. But when I tested it with an actual, second installation, that assumption proved to be false.

    I certainly have not stress tested this solution, but this works for my purposes, so I will accept it once the 2 days pass.