Sushant Gorde
Sushant Gorde

Reputation: 25

How Can I configure arguments for install4j generated launcher via properties file?

I have created installer using install4j for our application. I need to pass one argument which decides to which server profile my application should contact.

We have around 80 different profiles and we don't wish to create separate installer for each and evry server profile and would like to configure it at runtime for an exe file.

I also referred of creating response file as mentioned in install4j documentation below but even that did not help - https://www.ej-technologies.com/resources/install4j/help/doc/installers/responseFile.html

Any idea?

Upvotes: 1

Views: 326

Answers (1)

Ingo Kegel
Ingo Kegel

Reputation: 48070

There is no way to configure arguments with text files but you can define VM parameters in the .vmoptions file. If your launcher is named launcher.exe, the and the file launcher.vmoptions in the same directory contains the lines

-Dkey1=value1
-Dkey2=value2

then the system properties key1 and key2 are set to the respective values and can be queried with System.getProperty("<key name>").

Installer variables that are present in the response file are replaced automatically in .vmoptions file. If you add a .vmoptions file with the content

-Dserver=${installer:myServer}

and the installer variable myServer is defined in the installer and registered as a response file variable, you can execute System.getProperty("server") to get this value in the launcher.

Upvotes: 0

Related Questions