Trouble accessing installed packages

Error Information:

The downloaded binary packages are in
/var/folders/gx/1s4bnssd6g39xx4grym4ksm40000gp/T//RtmprJtq0d/downloaded_packages
> library('xlsx')
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

Description of issue -
I am fairly new to R, but have been using it for a few months with no issue. Now I suddenly cannot install and access new packages. The installation appears to work fine, but when I try to call library(), I get the error above.

Steps taken so far -
I tried updating Java; I checked the .libPaths() and there is just one and it looks correct; I tried updating all packages; I tried restarting R Studio and my computer.

System Information:

  • RStudio Edition: desktop
  • RStudio Version: Version 1.1.463
  • OS Version: macOS Mojave version 10.14.5
  • R Version: R version 3.5.3 (2019-03-11)

Also:

  • RStudio diagnostics report:
  • Your sessionInfo():
  • RStudio crash report:
  • RStudio application log files:

From Troubleshooting Guide: Using RStudio

Hi @aashea! Welcome!

xlsx depends on Java and rJava, which is notoriously difficult to get set up for many people. There are several other packages that can often cover people’s Excel interaction needs equally well without the troublesome Java dependency. The readxl package (which is one of them) has a list of alternatives in its documentation:

What do you need to do with xlsx? If you can do it with one of the non-Java alternatives, frankly I’d recommend starting there before sinking any more time into rJava configuration.

Thanks @jcblum! I was a bit concerned I just broke RStudio, but if that's the issue, I will go with another package then!

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