简体   繁体   English

如何在 MacOSX 上处理 R 代码中的 Java 错误?

[英]How to handle a Java-error in an R-code on MacOSX?

When running my R-code using Shiny I get the following error message, only on my Mac (Catalina, V 10.15.1) but not on Windows:使用 Shiny 运行我的 R 代码时,我收到以下错误消息,仅在我的 Mac(Catalina,V 10.15.1)上而不是在 Windows 上:

Unable to find any JVMs matching version "(null)".
No Java runtime present, try --request to install.
Warnung in system("/usr/libexec/java_home", intern = TRUE)
  Ausführung von Kommando '/usr/libexec/java_home' ergab Status 1
Fehler: package or namespace load failed for ‘xlsx’:
 .onLoad failed in loadNamespace() for 'rJava', details:
  call: dyn.load(file, DLLpath = DLLpath, ...)
  error: kann shared object '/Library/Frameworks/R.framework/Versions/3.6/Resources/library/rJava/libs/rJava.so' nicht laden:
  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

As my code is very extensive and long I cannot post it on here.由于我的代码非常广泛而且很长,我不能在这里发布它。 However, I would appreciate any help as I am still a beginner.但是,由于我仍然是初学者,因此我将不胜感激。 Thank you!谢谢!

MacOS X does not come with Java Development Kits (JDKs) pre-installed. MacOS X 未预装 Java 开发工具包 (JDK)。

I recommend installing via HomeBrew then run the command: brew cask install java and it will install the latest Oracle JDK and sort out any config for you.我建议通过HomeBrew安装然后运行命令: brew cask install java cask brew cask install java它将安装最新的 Oracle JDK并为您整理任何配置。

Once you have the JDK, try running your R-Code again, it should be working fine and you should not see the Unable to find any JVMs error.拥有 JDK 后,再次尝试运行 R-Code,它应该可以正常工作并且您应该不会看到Unable to find any JVMs错误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM