Data Files
Typically, installers are single files that contain all data that they can install when they are executed. There are three common situations where this is not the case:
DVD installers with large data files
If your application relies on large amounts of data, it is often distributed on a DVD. In that case, you typically ship a number of external data files that you do not wish to package inside the installer. The installer should start up quickly, and the data files should not be extracted from the installer to save time. The user might decide to install only certain components, so some data files might not be needed at all. If they are included in the installer executable, all this data would have to be read from disk.Installers with large optional components
Some applications have large optional components that are not relevant for the typical user. To reduce download size for the majority, the optional components should be downloadable on demand.Net installers
Some applications are highly modular, so it is not feasible to build a set of installers for typical use cases. A net installer lets the user select the desired components and downloads them on demand. The download size of the net installer is small because no parts of the actual application are contained in the installer itself.
To accommodate the above use cases, install4j offers three different ways to handle the installer data files. The data file mode can be selected in the "Data files" step of the media wizard. By default, the "Included in media file" option is selected where all data files are included in the installer, so you can ship it as a single download.
External data files
This mode covers the "DVD installers with large data files" use case.
Next to your installer, a directory for the data files is created with the name of your installer
and the extension .dat
. For example, if your media file name is hello_4_0
,
resulting in a Windows installer executable hello_4_0.exe
, the directory containing the external
data files is named hello_4_0.dat
. You have to ship this directory in the same relative
location on your DVD.
The number of data files depends on the definition of your installation components. The data files are generated in such a way that
- the files for an installation component are contained in one or more data files
- there are no files in those data files that do not belong to this installation component
If components do not overlap, there's a one-to-one correspondence between data files and installation components.
Downloadable data files
This mode covers the "Installers with large optional components" and "Net installers" use cases. It can only be used if you define installation components.
Data files are generated just like for the "External" mode, but only for installation components that have been marked as downloadable in the installation component definition.
If no installation components are marked as "downloadable", this mode will behave like the "Included in media file" mode. For a "net installer", all installation components should be "downloadable".
For this mode, you have to enter a HTTP download URL, so the installer knows from where it should
download the data files at runtime if the user requests downloadable components. The URL must begin with
http://
or https://
and point to a directory where you place the data files
that the compiler produces in the .dat
folder next to the installer.
The build output will list the data files that belong to downloadable installation components with a message like
Important: Please make sure that the following files can be downloaded from https://www.test.com/components hello_windows-x64_8_0.41.dat
This means that the data file must be uploaded to the web server, so that the installer can download it from the URL
https://www.test.com/components/hello_windows-x64_8_0.41.dat
Any data files that you leave in the data file directory next to the installer will not be downloaded. This means that if you test your installer directory from the location where it was generated, the installer finds all data files in the data file directory and does not try to download them.
Naming and partitioning of data files
The naming of data files is stable and only depends on the name of the media file and the downloadable installation components.
For example, say your installer includes the following 7 files:
file_1.txt file_2.txt file_3.txt file_12.txt file_13.txt file_23.txt file_123.txt
and there are three installation components with IDs 1, 2 and 3 that include the following files:
Component 1: file_1.txt file_12.txt file_13.txt file_123.txt Component 2: file_2.txt file_12.txt file_23.txt file_123.txt Component 3: file_3.txt file_13.txt file_23.txt file_123.txt
Note that some files are in multiple components, and in the above scheme each component includes all files whose number contains the ID of the installation component.
If the media file is named test
, the compiler then produces one data file per component named
test.X.dat
with the files that are included exclusively by the corresponding component:
test.1.dat file_1.txt test.2.dat file_2.txt test.3.dat file_3.txt
Next, data files named test.X.Y.dat
for the files that are included in exactly
two components are generated:
test.1.2.dat file_12.txt test.1.3.dat file_13.txt test.2.3.dat file_23.txt
Finally, a data file is generated that includes files that appear in all three components:
test.1.2.3.dat file_123.txt
When generalizing this partitioning to N installation components, a maximum number of
2N - 1
data files are created. In practice, it is more likely
that each installation component only has exclusive files and that there will be N
data files.
For the downloadable data file mode, only the downloadable installation components are included in this partition. Files that belong to other installation components are included in the installer and do not play any role in the creation of data files.