Rajeev
Rajeev

Reputation: 57

Install4j varfile doesnt' read few variables

Installer is installed typically using GUI or console, we need unattended installation capability as well. Running the installer like this (in Linux):

myapp -q -c -varfile myfile.var

Installer installs the software successfully. Problem is it ignores some variables (not all variables). It doesn't read values for zServerPort$Long and zShutdownPort$Long variables and instead applies the default values configured in application.

Varfile is provided below

#install4j response file for Sw 4.6
#Mon Aug 11 19:55:46 PDT 2014
sys.adminRights$Boolean=true
choiceIsLicenseSelected=true
zDBUserName=user
zLaunchDesktopPostInstall$Boolean=false
zDBPassWord=password
sys.languageId=en
sys.installationDir=/opt/mydir
zServerPort$Long=85
zLicenseFilePath=/home/mydir/Desktop/license.lic
zMysqlPath=/usr/bin/mysql
zMysqlCnf=/etc/mysql/my.cnf
zDbPort$Long=3306
choiceInstallDir=/opt/mydir
zShutdownPort$Long=8015

zServerPort, zShutdownPort, choiceInstallDir, zMysqlPath are all installer variables. Reordering the variables didn't work either. Is the problem due to data type being Long ?

Is there a way to pass the values of these two variables zServerPort, zShutdownPort in some other way ?

Other idea am thinking is whether if the installer can know that it is being run in unattended mode and read these variables from command line ?

Upvotes: 1

Views: 908

Answers (1)

Ingo Kegel
Ingo Kegel

Reputation: 48005

Most likely, the defaults are applied with a code snippet and not through the initial values of form components.

In those code snippets (i.e. in a "Run script" action"), you have to check whether the value is already defined or not. For example:

if (context.getVariable("variableName") != null) {
    context.setVariable("variableName"), 100L);
}

Upvotes: 1

Related Questions