1

I recently updated to Sierra and it seems like I can't load packages that depends on rJava anymore.

For example:

library(xlsx)

Gives:

Loading required package: rJava
Loading required package: xlsxjars
JavaVM: requested Java version ((null)) not available. Using Java at "" instead.
JavaVM: Failed to load JVM: /bundle/Libraries/libserver.dylib
JavaVM FATAL: Failed to load the jvm library.
Error : .onLoad failed in loadNamespace() for 'xlsx', details:
  call: .jinit()
  error: JNI_GetCreatedJavaVMs returned -1

Error: package or namespace load failed for ‘xlsx’

Here is my sessions info:

R version 3.3.2 (2016-10-31)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: macOS Sierra 10.12

And Java is updated to the latest version (8.111).

Uwe
  • 41,420
  • 11
  • 90
  • 134
Dambo
  • 3,318
  • 5
  • 30
  • 79
  • This is a different error than I got with `rjava` when I upgraded to Yosemite, but, in case it might be useful, [here's a link](http://stackoverflow.com/questions/30738974/rjava-load-error-in-rstudio-r-after-upgrading-to-osx-yosemite) to the question I asked, in case the answers might be helpful. – eipi10 Nov 09 '16 at 16:30
  • @eipi10 `library('rJava')` doesn't retrieve any errors (from both RStudio and the terminal), thus I am not sure how to adapt the answers to your question. Have you upgraded to Sierra yet? Does everything works fine? – Dambo Nov 09 '16 at 20:47
  • If you do not include the details of your JVM installation, then there's little that can be said. I doubt that there would be anything at `""` that could substitute for a properly installed Java library. – IRTFM Nov 09 '16 at 22:13

1 Answers1

1

As far as I can understand from some similar posts the java directories is not configured correctly.

You can solve this with terminal commands that fix the wrongly configured directories and there are multiple posts that use this strategy. But this can be rather confusing.

A much easier strategy that worked for me is to use homebrew to install java. After installing Homebrew you can install java with the following commands

brew update
brew cask install java
Community
  • 1
  • 1
Havard
  • 11
  • 1