0

I installed package xlsx in R studio on Mac. It is the first time to install R studio on this computer. But I got an error when tried to install it:

> library("xlsx")
Unable to find any JVMs matching version "(null)".
No Java runtime present, try --request to install.
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.6/Resources/library/rJava/libs/rJava.so':
  dlopen(/Library/Frameworks/R.framework/Versions/3.6/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.6/Resources/library/rJava/libs/rJava.so
  Reason: image not found
In addition: Warning message:
In system("/usr/libexec/java_home", intern = TRUE) :
  running command '/usr/libexec/java_home' had status 1

I am not sure what wrong I am doing. Thank you for the help!

Jessica
  • 391
  • 1
  • 3
  • 16
  • You need to make sure that you have a JRE installed and accessible. Take a look at the duplicate target post, which includes some OS-specific advice. Perhaps an alternative is to use `readxl` which does not depend on Java. – Maurits Evers Mar 01 '20 at 21:18
  • 1
    The openxlsx oackage is an excellent Java-free alternative – Allan Cameron Mar 01 '20 at 21:19
  • 3
    or `readxl::read_excel` which is part of the `tidyverse` so you may have it already – rawr Mar 01 '20 at 21:24
  • I tried to install rJava package and it happened again. I also tried installing tidy verse but same thing. I am not sure how to install any package in R studio now. – Jessica Mar 01 '20 at 22:57

0 Answers0