B4J Tutorial Making Installers for Server Apps

Part 1

I have been on the lookout for a simple way to create an installer for my server apps - Ive looked at Inno Setup etc before but I wanted something simple.

My apps are currently bundled as zip files which are then given to customers. Although this works its a not as desirable as a proper installer as the user may not unzip it correctly.

As I was already distributing as a zip file I got to thinking about self-extracting archive. It turns out that 7-zip can already support this through the UI

1608513003537.png


My release packing is scripted so I wanted to script the self-extracting archive as well.

Here is the documentation for the command line to create a self-extracting archive (SFX)


To script a SFX we need to create config file like this;

B4X:
;!@Install@!UTF-8!
Title="7-Zip 4.00"
BeginPrompt="Do you want to install the 7-Zip 4.00?"
RunProgram="setup.exe"
;!@InstallEnd@!

And then use command line to merge the SFX and your zip file like this (I place the sfx and confil files in the same directory as my zipped project);

B4X:
copy /b 7zSD.sfx + config.txt + myB4Jproject.7z MyInstaller.exe

This will create an executable called MyInstaller.exe that the user can run and be prompted for a location to unzip to.
 
Last edited:

tchart

Well-Known Member
Licensed User
Longtime User
Part 2

In addition to the above you can also specify whether the SFX should execute a program after the extraction. This is useful for example if you wish to register the app as a windows service.

1608513419923.png
 

tchart

Well-Known Member
Licensed User
Longtime User
Part 3 (for more advanced users)

While the default SFX is useful you will probably notice a few things.

1. You cant specify the default extraction directory
2. If your additional executable requires elevated privileges (ie admin) the user wont know until its too late

This lead me to this project; https://sourceforge.net/projects/s-zipsfxbuilder/

7z SFX Builder is a GUI application that allows you to have greater control over the SFX process. Options include the requirement for admin as well as custom dialogs and a default extract path.

NOTE this project is open source but it is not part of the official 7-zip package, as a result some people seem apprehensive to use it.

1608513742179.png
 
Last edited:
Top