简体   繁体   English

在 MacOSX 上安装 `rJava` 失败并显示“JDK 不完整!...”

[英]Installing `rJava` on MacOSX fails with “JDK is incomplete!…”

I am trying to install rJava on my Mac but I get the following error message:我正在尝试在我的 Mac 上安装rJava ,但收到以下错误消息:

[...]
checking whether javah was replaced by javac -h... no
configure: error: one or more Java tools are missing.

*** JDK is incomplete! Please make sure you have a complete JDK. JRE is *not* sufficient.
configure: error: ./configure failed for jri
ERROR: configuration failed for package ‘rJava’
* removing ‘/usr/local/lib/R/3.6/site-library/rJava’
Warning in install.packages :
  installation of package ‘rJava’ had non-zero exit status

However, I have java and javac so I don't simply have a JRE:但是,我有javajavac所以我只是有一个 JRE:

$ java -version
openjdk version "1.8.0_242"
OpenJDK Runtime Environment (AdoptOpenJDK)(build 1.8.0_242-b08)
OpenJDK 64-Bit Server VM (AdoptOpenJDK)(build 25.242-b08, mixed mode)
$ javac -version
javac 1.8.0_242

I am however slightly bothered by the line然而,我对这条线有点困扰

JAVA_HOME        : /Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home/jre 

in R CMD javareconf .R CMD javareconf Because it ends with jre.因为它以jre结尾。 Is that part of my problem?那是我问题的一部分吗?

I have done some googling but I have not found much.我做了一些谷歌搜索,但我没有找到太多。 For example the last comment on https://github.com/su/rJava/issues/146 is not promising.例如,关于https://github.com/su/rJava/issues/146的最后一条评论并不乐观。

What should I do to be able ro run rJava ?我应该怎么做才能运行rJava

As the error suggests, it is finding the JRE as your JAVA_HOME .正如错误所暗示的,它发现JRE作为您的JAVA_HOME Just set JAVA_HOME to point to JDK, something like:只需将JAVA_HOME为指向 JDK,例如:

export JAVA_HOME=/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home/

Then try to install rJava , if that is working you can add the export in your profile startup files.然后尝试安装rJava ,如果可以,您可以在配置文件启动文件中添加导出。

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

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