Error: package or namespace load failed for ‘rJava’:

install.packages("xlsx")
library(rJava)
it gives following error in R studio:
Error: package or namespace load failed for ‘rJava’:
.onLoad failed in loadNamespace() for 'rJava', details:
call: inDL(x, as.logical(local), as.logical(now), ...)
error: unable to load shared object 'C:/Program Files/R/R-3.6.1/library/rJava/libs/x64/rJava.dll':
LoadLibrary failure: The specified module could not be found

Do you have an installation of Java in your system with matching architecture (i.e. 32bit or 64bit depending on your R version)? Besides this you have to set your JAVA_HOME variable, you can do it in your Rprofile.site file adding a line similar to this but with your own installation path

Sys.setenv('JAVA_HOME'="C:/Program Files/Java/jdk-11.0.1/")
1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.