MacOS 无法识别 MacOS 10.14.6 上更新的 Java
MacOS does not recognize updated Java on MacOS 10.14.6
在通过 Homebrew 将 R 更新到 3.6.1 后重新安装包的过程中,我遇到了这个问题(运行在 RStudio 1.2.5019 中):
install.packages( "rJava" )
...
...
...
configure: error: One or more Java configuration variables are not set.
Make sure R is configured with full Java support (including JDK). Run
R CMD javareconf
as root to add Java support to R.
If you don't have root privileges, run
R CMD javareconf -e
to set all Java-related variables and then install rJava.
ERROR: configuration failed for package ‘rJava’
* removing ‘/usr/local/lib/R/3.6/site-library/rJava’
运行
bash-3.2$ sudo R CMD javareconf
产量
Java interpreter : /usr/bin/java
Java version : 1.8.0_25
Java home path : /Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home/jre
Java compiler : /usr/bin/javac
Java headers gen.: /usr/bin/javah
Java archive tool: /usr/bin/jar
trying to compile and link a JNI program
detected JNI cpp flags : -I$(JAVA_HOME)/../include -I$(JAVA_HOME)/../include/darwin
detected JNI linker flags : -L$(JAVA_HOME)/lib/server -ljvm
clang -I"/usr/local/Cellar/r/3.6.1_1/lib/R/include" -DNDEBUG -I/Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home/jre/../include -I/Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home/jre/../include/darwin -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/include -fPIC -g -O2 -c conftest.c -o conftest.o
clang -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/usr/local/Cellar/r/3.6.1_1/lib/R/lib -L/usr/local/opt/gettext/lib -L/usr/local/opt/readline/lib -L/usr/local/lib -o conftest.so conftest.o -L/Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home/jre/lib/server -ljvm -L/usr/local/Cellar/r/3.6.1_1/lib/R/lib -lR -lintl -Wl,-framework -Wl,CoreFoundation
JAVA_HOME : /Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home/jre
Java library path: $(JAVA_HOME)/lib/server
JNI cpp flags : -I$(JAVA_HOME)/../include -I$(JAVA_HOME)/../include/darwin
JNI linker flags : -L$(JAVA_HOME)/lib/server -ljvm
Updating Java configuration in /usr/local/Cellar/r/3.6.1_1/lib/R
Done.
Re 运行ning install.packages( "rJava" )
产生略有不同的错误消息:
*** 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
但我注意到 R CMD javareconf
的输出列出了一个旧的 Java 版本:1.8.0_25。 运行 java -version
确认:
java version "1.8.0_25"
Java(TM) SE Runtime Environment (build 1.8.0_25-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)
运行 /usr/libexec/java_home -V
确认仅安装了 1.8.0_25(即使已经下载并 运行 最新 Java 版本的安装程序) :
Matching Java Virtual Machines (1):
1.8.0_25, x86_64: "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home
/Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home
查看 Java Control Panel 表明 1.8.0_231-b11 应该已安装。
我已经尝试卸载 Java 并重新安装 Java 但没有效果。
为什么会出现差异?我如何让他们 OS 识别最新版本?
我是 运行宁 MacOS Mojave 10.14.6
谢谢,
好的,新手错误。我正在安装 JRE 而不是 JDK。从 Oracle 下载 JDK 并安装解决了 java 版本问题。
在通过 Homebrew 将 R 更新到 3.6.1 后重新安装包的过程中,我遇到了这个问题(运行在 RStudio 1.2.5019 中):
install.packages( "rJava" )
...
...
...
configure: error: One or more Java configuration variables are not set.
Make sure R is configured with full Java support (including JDK). Run
R CMD javareconf
as root to add Java support to R.
If you don't have root privileges, run
R CMD javareconf -e
to set all Java-related variables and then install rJava.
ERROR: configuration failed for package ‘rJava’
* removing ‘/usr/local/lib/R/3.6/site-library/rJava’
运行
bash-3.2$ sudo R CMD javareconf
产量
Java interpreter : /usr/bin/java
Java version : 1.8.0_25
Java home path : /Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home/jre
Java compiler : /usr/bin/javac
Java headers gen.: /usr/bin/javah
Java archive tool: /usr/bin/jar
trying to compile and link a JNI program
detected JNI cpp flags : -I$(JAVA_HOME)/../include -I$(JAVA_HOME)/../include/darwin
detected JNI linker flags : -L$(JAVA_HOME)/lib/server -ljvm
clang -I"/usr/local/Cellar/r/3.6.1_1/lib/R/include" -DNDEBUG -I/Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home/jre/../include -I/Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home/jre/../include/darwin -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/include -fPIC -g -O2 -c conftest.c -o conftest.o
clang -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/usr/local/Cellar/r/3.6.1_1/lib/R/lib -L/usr/local/opt/gettext/lib -L/usr/local/opt/readline/lib -L/usr/local/lib -o conftest.so conftest.o -L/Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home/jre/lib/server -ljvm -L/usr/local/Cellar/r/3.6.1_1/lib/R/lib -lR -lintl -Wl,-framework -Wl,CoreFoundation
JAVA_HOME : /Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home/jre
Java library path: $(JAVA_HOME)/lib/server
JNI cpp flags : -I$(JAVA_HOME)/../include -I$(JAVA_HOME)/../include/darwin
JNI linker flags : -L$(JAVA_HOME)/lib/server -ljvm
Updating Java configuration in /usr/local/Cellar/r/3.6.1_1/lib/R
Done.
Re 运行ning install.packages( "rJava" )
产生略有不同的错误消息:
*** 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
但我注意到 R CMD javareconf
的输出列出了一个旧的 Java 版本:1.8.0_25。 运行 java -version
确认:
java version "1.8.0_25"
Java(TM) SE Runtime Environment (build 1.8.0_25-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)
运行 /usr/libexec/java_home -V
确认仅安装了 1.8.0_25(即使已经下载并 运行 最新 Java 版本的安装程序) :
Matching Java Virtual Machines (1):
1.8.0_25, x86_64: "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home
/Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home
查看 Java Control Panel 表明 1.8.0_231-b11 应该已安装。
我已经尝试卸载 Java 并重新安装 Java 但没有效果。
为什么会出现差异?我如何让他们 OS 识别最新版本?
我是 运行宁 MacOS Mojave 10.14.6
谢谢,
好的,新手错误。我正在安装 JRE 而不是 JDK。从 Oracle 下载 JDK 并安装解决了 java 版本问题。