Cannot load rJava because cannot load a shared library
If you have read this threat and neither of the suggestions above has worked so far, then it might be worth trying one further:
- Windows 7
- R version 2.12.1 (2010-12-16) 64-bit
Java(TM) SE Runtime Environment (build 1.6.0_23-b05), Java HotSpot(TM) 64-Bit Server VM (build 19.0-b09, mixed mode)
JAVA_HOME=C:\Program Files\Java\jre6\bin\
Path= ...;C:\Program Files\Java\jre6\bin\server\;C:\Program Files\R\R-2.12.1\bin\x64\
The thing that finally solved my problem was to explicitly add \server\
to the PATH variable.
System information:R version 3.0.1 (2013-05-16)Platform: x86_64-w64-mingw32/x64 (64-bit)
I encountered this same problem. I was able to solve the issue with one line of code into the command window obtained from this website.
Sys.setenv(JAVA_HOME='C:\Program Files\Java\jre7')
Note that I used this particular line because I was on a 64 bit system. See website for 32-bit example.
Following up on some of Dirk's sage advice:
- Your path should probably say
C:\Program Files\Java\jre6\bin\
(remove "client"). - Your path should also have
C:\Program Files\R\R-2.10.1\bin\
. You don't need that explicit reference to the rJava libs. I would also then removeC:\Program Files\R
from the path. - Lastly, confirm that Java is accessible by either going to your command prompt and typing
java -version
, or from within R by typingsystem("java -version")
. - If you install the SDK, then you will also want a system variable
JAVA_HOME
which in my case points toC:\Sun\SDK\
.