SetEnvironmentVariable("PATH", path) not recognized within R

Jul 19, 2012 at 3:45 PM

I downloaded the April source code and compiled it. I distributed the software on 3 different machines with R installed and it  ran with flying colours. However, now there is a PC that does not run the software. It mentions that the RLAPACK.DLL is not found. A well known issue here.

I had set the PATH environment variable, obtaining the right path from the registry key for R, as instructed. As mentioned for 3 PC's it worked well, for number 4 it didn't.
Somehow the R process does not use that setting. This I checked as follows:

string pathWithR = ...;    // obtain from registry
System.Environment.SetEnvironmentVariable("PATH", pathWithR);
var setPath = System.Environment.GetEnvironmentVariable("PATH");

R = REngine.CreateInstance("RDotNet");

R.Initialize();
var pathInR = R.Evaluate("Sys.getenv('PATH')").AsCharacter().First();

Now we compare  pathWithR with setPath and pathInR. 
The setPath is the same as pathWithR, so that works. However, the pathInR is still the old path. A real pity as it otherwise works pretty well. Any clue?