This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallAnywhere
- :
- InstallAnywhere Knowledge Base
- :
- Setting an InstallAnywhere Variable from within Custom Code
Subscribe
- Mark as New
- Mark as Read
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
Setting an InstallAnywhere Variable from within Custom Code
Setting an InstallAnywhere Variable from within Custom Code
Summary
To set an InstallAnywhere Variable from within Custom Code, the setVariable(String varName, Object value) method can be used.Synopsis
To set an InstallAnywhere Variable from within Custom Code, the setVariable(String varName, Object value) method can be used.Discussion
Often times, custom code will need to pass an InstallAnywhere variable back in to the running installer. It is possible to set InstallAnywhere variables from within custom code by using the setVariable(String varName, Object value) method where ?varName? is the full variable name such as ?$USER_INSTALL_DIR$? and value is an object containing the value to be stored within the InstallAnywhere Variable.It is imperative to realize that all InstallAnywhere variables are stored as strings. Although an object can be stored to an InstallAnywhere variable, that object will be converted to a string. It is also important to note that the delimiter dollar signs must be included. Although the method is defined in multiple classes within the API, it comes from the VariableAccess Interface.
To set a sample variable:
package com.ia.kb; import com.zerog.ia.api.pub.*; public class SetAVariable extends CustomCodeAction { public void install( InstallerProxy ip) throws InstallException { ip.setVariable(?$MY_TEST_VAR$?, ?Test value?); } public void uninstall (UninstallerProxy up) { } public String getInstallStatusMessage() {return "My Action"; } public String getUninstallStatusMessage(){return "My Action"; } }
Doing so will set $MY_TEST_VAR$ within InstallAnywhere for use during the rest of the installation.
Related Documents
Methods of Setting InstallAnywhere Variables
No ratings