IzPack is a great installer written in Java and configured with XML files, though the documentation can be a little bit lacking. This OK because the variables are all named well so one can easily look to an existing installer (such as that for IzPack itself or 7-zip) and copy needed bits of code. One thing that I found elusive was how to set the default install directory to something other than "C:\Program Files\<product name>". The <info> element provides an <appsubpath> element that allows you to specify something other than <product name>, but you're still limited to something within the default Windows installation directory. Alas, mailing lists to the rescue! This post describes declaring a resource in the install.xml and after a bit of fiddling I came up with the following.
First, create a file TargetDir.txt with nothing more than the path you want to install at, for me that file simply contained "C:\foo". Next, point to the resource in the install.xml:
<resources>
<!-- Set the default installation directory shown in the TargetPanel -->
<res id="TargetPanel.dir" src="TargetDir.txt" />
</resources>
Rebuild the installer and you're set.
Does not work for me, path is always:
C:/Programme/Installation
Tried: “C:/foo” C:/foo/4a7d3d609129a9296bf7ac0608c2097
in the file TargetDir.txt
nothing changes.
Ensure that you pointed to the resource in your IzPack installation XML file (install.xml) and the file "TargetDir.txt" is in the same directory. Also, don't quote the directory in that file; simply put the literal c:/foo/
I found this very useful, thanks for the post!