Can't load package xlsx after upgrading to Sierra

吃可爱长大的小学妹 提交于 2019-12-08 04:19:45

问题


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).


回答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


来源:https://stackoverflow.com/questions/40511438/cant-load-package-xlsx-after-upgrading-to-sierra

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!