I ran into the same problem trying to install.packages("rJava")
in R version 3.0.2, as long as I tried to install as ordinary user (Linux, Debian). There was no problem running install.packages("rJava")
as root. Then, trying library(rJava)
worked for root but not for me as a user:
Error : .onLoad failed in loadNamespace() for 'rJava', details:
call: dyn.load(file, DLLpath = DLLpath, ...)
error: unable to load shared object '/usr/usr.local.original.Debian/lib/R/site-library/rJava/libs/rJava.so':
libjvm.so: cannot open shared object file: No such file or directory
This problem required to add the environment variables JAVA_HOME
and LD_LIBRARY_PATH
to ~/.login
(following instructions found at Trouble in Setting Java Environment Path on Ubuntu (libjvm.so: cannot open shared object file: No such file or directory)):
setenv JAVA_HOME /usr/lib/jvm/java-7-oracle/
setenv LD_LIBRARY_PATH $JAVA_HOME/jre/lib/amd64:$JAVA_HOME/jre/lib/amd64/server
# For c-shell; for bash, it would have to be:
export JAVA_HOME=/usr/lib/jvm/java-7-oracle/
export LD_LIBRARY_PATH=$JAVA_HOME/jre/lib/amd64:$JAVA_HOME/jre/lib/amd64/server
So, you would have to have a system administrator install rJava for you, then set your environment variables and, of course, set your own .libPaths()
in R such as to find rJava.