Reputation: 3
i just installed Rstudio and wanted some packaes to use, im using linux mint, when i tried to install the xlsx package give an error related to rjava, so i installed the rjava package, but it cant be loaded, instead i get this error:
>library("rJava", lib.loc="/usr/lib/R/site-library")
Error : .onLoad failed in loadNamespace() for 'rJava', details:
call: dyn.load(file, DLLpath = DLLpath, ...)
error: unable to load shared object '/usr/lib/R/site-
library/rJava/libs/rJava.so':
libjvm.so: cannot open shared object file: No such file or directory
Error: package or namespace load failed for ‘rJava’
>detach("package:rJava", unload=TRUE)
Error in detach("package:rJava", unload = TRUE) : invalid 'name'
argument
I tried R CMD javareconf several times, but still no clue of the problem
Upvotes: 0
Views: 4887
Reputation: 5487
You may want to locate the library, you can use the whereis
command or look into standard path which are :
/usr/lib/jvm/java-7-oracle/lib/amd64
/usr/lib/jvm/java-7-oracle/jre/lib/amd64/server
Once it's located, copy its folder's path.
Then add it to the LD_LIBRARY_PATH environment variable located in ~/.profile
(create the file if needed).
export LD_LIBRARY_PATH=/usr/lib/jvm/java-7-oracle/lib/amd64:/usr/lib/jvm/java-7-oracle/jre/lib/amd64/server
If you already have a LD_LIBRARY_PATH set you may want to keep it, so
echo $LD_LIBRARY_PATH
and add its content into the~/.profile
file.
You can reboot to reload the .profile, or you can just source ~/.profile
form a terminal.
To conclude just sudo R CMD javareconf
.
Upvotes: 3