0

I am trying to install "xlsx" library in my R studio. But since I was not having "rJava" installed, the installation didn't go through.

No when I am trying to install "rJava" after installing jdk in my mac, still I am getting the same error while installation, below is the error for both the libraries.

"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"

"Error: package or namespace load failed for ‘rJava’:
 .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"
mt1022
  • 16,834
  • 5
  • 48
  • 71

1 Answers1

0

Getting rJava to be recognised seems to be a bit tricky. It looks as though R might be trying to look for it in the wrong place, in which case you could try the solutions to the similar question Error of java path on loading rJava package or the comments on Issue while connecting rJava in R Studio

Depending on what you need the xlsx library for, the tidyverse series of packages have packages for reading and writing xlsx files which are not dependent on Java, see here

ovid
  • 51
  • 2
  • 7