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 Forum
- :
- Re: Setting and using environment variables
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Dec 26, 2007
11:51 AM
Setting and using environment variables
During the install phase I create a couple of environment variables using the "Set System Environment Variable" action. I run some executables and scripts during the install process that rely on those variables, however, they don't seem to be set. I tried using the RefreshEnvironment plug-in, but it doesn't seem to work either. After installation, I can see that the environment variables are set under System Properties but not when I open a new command prompt and type "set". Is it possible to refresh the environment so that these variables are usable without having to restart the system?
(8) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Dec 27, 2007
06:44 AM
hi,
even i have the same requirement,from where did you find the refresh environment plugiin.
I am trying to set a system environment variable to a installanywhere variable and use the system environment variable in my batch file .
how do i do it
even i have the same requirement,from where did you find the refresh environment plugiin.
I am trying to set a system environment variable to a installanywhere variable and use the system environment variable in my batch file .
how do i do it
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Dec 27, 2007
09:38 AM
The RefreshEnvironment plug-in is an InstallAnywhere action. It is listed under the Plug-Ins tab when you choose Add Action. The description for the plug-in reads, "This action will force the Windows operating system to refresh its environment. This is helpful right after a Set Environment Variable action." As mentioned, this didn't appear to work for me.
I had to take a less than optimal approach to work around this issue. I am using the Execute Script/Batch file action and setting the environment variables at the top and then copying the contents of the batch file below. The problem with this, is that I need to maintain both the batch file and the code in the installer. For everything else that relies on the environment variable after installation, it looks like I'll just have to restart Windows.
Another option I considered was to use the Modify Text File action and explicitly set the environment variables in the batch files. Then I could run either Execute Command or Execute Target File on the batch file. Unfortunately there are more than just a couple of batch files that rely on this environment variable.
I had to take a less than optimal approach to work around this issue. I am using the Execute Script/Batch file action and setting the environment variables at the top and then copying the contents of the batch file below. The problem with this, is that I need to maintain both the batch file and the code in the installer. For everything else that relies on the environment variable after installation, it looks like I'll just have to restart Windows.
Another option I considered was to use the Modify Text File action and explicitly set the environment variables in the batch files. Then I could run either Execute Command or Execute Target File on the batch file. Unfortunately there are more than just a couple of batch files that rely on this environment variable.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Apr 08, 2008
05:57 PM
Has anyone resolved this issue? I am having the same issue. I set a system environment variable, call RefreshEnvironment plug-in, and then execute custom code which is a java method to print out System.getenv() and my new variable setting did not get applied. I confirmed that I am seeing other environment variables such as PATH, its just the environment variable I set with IA is not actually getting applied.
There are no warnings or errors in the debug console (holding CTRL down while installer running). There is however a message printed "Calling Refresh Environment"
There are no warnings or errors in the debug console (holding CTRL down while installer running). There is however a message printed "Calling Refresh Environment"
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Apr 11, 2008
09:42 AM
hi jerry,
i am trying to fix this issue using java native interface.
If you can just contribute to this issue help me out in solving this refreshing problem.
james.
i am trying to fix this issue using java native interface.
If you can just contribute to this issue help me out in solving this refreshing problem.
james.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Apr 16, 2008
07:18 AM
hi,
you need to proceed as this:
Inside it you will get a refresh.dll file we need to install it in windir that is in C:\WINDOWS in case of windows xp and in C:\WINNT in case of windows 2000
in the first place then we need to add execute custom code action tab
and then add the refreshenvironment.jar and give the classname as RefreshEnvironment ,just check once and revert back for any clarifications.
james.
you need to proceed as this:
Inside it you will get a refresh.dll file we need to install it in windir that is in C:\WINDOWS in case of windows xp and in C:\WINNT in case of windows 2000
in the first place then we need to add execute custom code action tab
and then add the refreshenvironment.jar and give the classname as RefreshEnvironment ,just check once and revert back for any clarifications.
james.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎May 06, 2008
04:50 AM
Hello,
I've got the same problem with the environment variable. The plugin RefreshEnvironment works properly under Windows - Vista but not XP. I've replaced this plugin with the custom code action you described, but it didn't change anything. I get the same error as by plugin:
class RefreshEnvironment NonfatalInstallException :
....\Temp\I1209872707\Windows\refresh.dll
0x80070020 The process cannot access the file because it is being used by another process.
Did you find the solution till now? Thank you for any advice
Anna
I've got the same problem with the environment variable. The plugin RefreshEnvironment works properly under Windows - Vista but not XP. I've replaced this plugin with the custom code action you described, but it didn't change anything. I get the same error as by plugin:
class RefreshEnvironment NonfatalInstallException :
....\Temp\I1209872707\Windows\refresh.dll
0x80070020 The process cannot access the file because it is being used by another process.
Did you find the solution till now? Thank you for any advice
Anna
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎May 07, 2008
12:01 AM
We face the same problem too. The system needs a restart for the env variables to be active.
Thus, we not only set the variables via the installer but also place scripts in the temp folder & run it, in case the env variables are needed by the installer itself. (The scripts basically set the env variables)
Thus, we not only set the variables via the installer but also place scripts in the temp folder & run it, in case the env variables are needed by the installer itself. (The scripts basically set the env variables)
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jul 22, 2008
06:58 AM
Hello,
something about the reason for our problems:
IA tries to propagate changes on environment variables with the RefreshEnvironment plugin. (See WM_SETTINGCHANGE message on http://support.microsoft.com/kb/104011/en-us) On Unix shells this is simply the export command. The first message in this thread matches my results without the plugin.
For me the RefreshEnvironment plugin is working with IA2008 VP1 as a post installation action.
But you must not call it twice. Otherwise the refresh.dll will be in use. It seems like it is called somewhere at the end of the installer.
The plugin still does not work on uninstallations (bug #IOC-000053634) and there seems to be no date for a resolution.
Calling an msi-Installer seems to be a workaround. Has anyone succeeded with a custom action?
something about the reason for our problems:
IA tries to propagate changes on environment variables with the RefreshEnvironment plugin. (See WM_SETTINGCHANGE message on http://support.microsoft.com/kb/104011/en-us) On Unix shells this is simply the export command. The first message in this thread matches my results without the plugin.
For me the RefreshEnvironment plugin is working with IA2008 VP1 as a post installation action.
But you must not call it twice. Otherwise the refresh.dll will be in use. It seems like it is called somewhere at the end of the installer.
The plugin still does not work on uninstallations (bug #IOC-000053634) and there seems to be no date for a resolution.
Calling an msi-Installer seems to be a workaround. Has anyone succeeded with a custom action?