rhome.c: getRHOME() fails, if R is called from SJava (PR#2003)

grimm.heinz@rcc.ch grimm.heinz@rcc.ch
Wed, 11 Sep 2002 15:17:55 +0200 (MET DST)


Full_Name: Heinz Grimm
Version: R1.5.1
OS: Windows NT 4.0
Submission from: (NULL) (195.65.178.178)


The R error message is:
"Fatal error: Unable to open base package"

The reason is:
getRHome() returns e.g. d:/r-project/R-1.5.1 if called within R (correct)

getRHome() returns e.g. D:/jdk1.3.1_01/jre if R is called from SJava (0.65),
hence
R tries to load the base library from D:/jdk1.3.1_01/jre/library/base/R/base
(very
bad)

I have modified $R_HOME/src/gnuwin32/rhome.c in this way:

char *getRHOME()
{
    char *RHome;

    RHome = getenv("R_HOME");
    if(!RHome)
    {
      RHome = getenv("RHOME");
    }
    if(!RHome)
    {
      fprintf(stderr, "No R_HOME environment variable value\n");fflush(stderr);
      exit(1);
    }
    strcpy( rhomebuf, RHome);
    return (rhomebuf);
}

now it works fine!

Heinz Grimm

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._