为什么我得到" JNI_GetCreatedJavaVMs返回-1"在R中加载xlsx包时出错?

时间:2016-01-24 16:32:35

标签: java r xlsx

我刚刚在R中下载了xlsx包,但我无法使用该库。 (在Mac上)

> library(xlsx)
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’

我做错了什么?

1 个答案:

答案 0 :(得分:0)

确保已安装依赖项:

  • xlsxjars
  • rJava

当然,如果这不起作用,请确认您已在Mac中安装了Java JDK:javac -version如果没有,请从此处安装:https://java.com/en/download/faq/java_mac.xml