Hi, I am trying to install the xlsx package to enable a conversion of my PDF into Excel. I have already installed pdftools and pdftables. However, my R Studio is giving trouble to install xlsx package. I get the following message after install.packages("xlsx"):
Installing package into ‘/Users/mohitarora/Library/R/3.5/library’
(as ‘lib’ is unspecified)
There is a binary version available but the source version is later:
binary source needs_compilation
xlsx 0.6.3 0.6.5 FALSE
installing the source package ‘xlsx’
trying URL 'https://cran.rstudio.com/src/contrib/xlsx_0.6.5.tar.gz'
Content type 'application/x-gzip' length 489493 bytes (478 KB)
==================================================
downloaded 478 KB
* installing *source* package ‘xlsx’ ...
** package ‘xlsx’ successfully unpacked and MD5 sums checked
** R
** inst
** byte-compile and prepare package for lazy loading
Error : .onLoad failed in loadNamespace() for 'rJava', details:
call: dyn.load(file, DLLpath = DLLpath, ...)
error: unable to load shared object '/Library/Frameworks/R.framework/Versions/3.5/Resources/library/rJava/libs/rJava.so':
dlopen(/Library/Frameworks/R.framework/Versions/3.5/Resources/library/rJava/libs/rJava.so, 6): Library not loaded: /Library/Java/JavaVirtualMachines/jdk-11.0.1.jdk/Contents/Home/lib/server/libjvm.dylib
Referenced from: /Library/Frameworks/R.framework/Versions/3.5/Resources/library/rJava/libs/rJava.so
Reason: image not found
ERROR: lazy loading failed for package ‘xlsx’
* removing ‘/Users/mohitarora/Library/R/3.5/library/xlsx’
Warning in install.packages :
installation of package ‘xlsx’ had non-zero exit status
And when I call the library(xlsx), I get the following message:
Error: package or namespace load failed for ‘xlsx’:
.onLoad failed in loadNamespace() for 'rJava', details:
call: dyn.load(file, DLLpath = DLLpath, ...)
error: unable to load shared object '/Library/Frameworks/R.framework/Versions/3.5/Resources/library/rJava/libs/rJava.so':
dlopen(/Library/Frameworks/R.framework/Versions/3.5/Resources/library/rJava/libs/rJava.so, 6): Library not loaded: /Library/Java/JavaVirtualMachines/jdk-11.0.1.jdk/Contents/Home/lib/server/libjvm.dylib
Referenced from: /Library/Frameworks/R.framework/Versions/3.5/Resources/library/rJava/libs/rJava.so
Reason: image not found
Any help/ideas as to how can I fix this error?