Community Forums
Results 1 to 2 of 2

Thread: How to refer external file in USER_INSTALL_FOLDER during installation?

  1. #1
    Join Date
    Aug 2018
    Posts
    3

    How to refer external file in USER_INSTALL_FOLDER during installation?

    I am using InstallAnywhere to install my java application. As a pre-install step I am taking database details from the user and storing it in an XML which is in install Directory. At the time of installation I want to refer this xml file to make DB connection. How can I configure installanywhere to refer to this external file at the time of installation? I don't want to bundle it with installer exe. Mini Militia App Lock 7Zip
    Last edited by jaisonsingh; 09-04-2018 at 02:19 PM.

  2. #2
    Join Date
    Sep 2018
    Posts
    3
    You can create a file similar to what is shown below, that ships with your application. You could call it, say, connection.xml:

    <connection>
    <user-name>$CONNECTION_USER_NAME$</user-name>
    <password>$CONNECTION_PASSWORD$</password>
    <database>$CONNECTION_DATABASE$</database>
    </connection>
    Collect the user input into InstallAnywhere variables that match the variables you embed in the template XML file. In this example these would be $CONNECTION_USER_NAME$, $CONNECTION_PASSWORD$ and $CONNECTION_DATABASE$.

    Add the "Modify Text File - Single File" Action to your project. Check the "Substitute InstallAnywhere variables in file" checkbox. This will automatically replace your embedded IA variables with the values collected from the user.

    After the "Modify Text File - Single File" Action completes, the variables in the file will be replaced with the values the user entered. You can then use connection.xml to create your database connection.

    In post-installation you could use the Delete File Action to remove the XML file. Alternately, you could run the "Modify Text File - Single File" Action again to search for and replace the password with a series of asterisk, or some other masking character.

    Cheers!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •