使用install.packages("rJava")命令安装rJava时出现以下错误:
checking Java support in R... present:
interpreter : '/usr/bin/java'
archiver : '/usr/bin/jar'
compiler : '/usr/bin/javac'
header prep.: '/usr/bin/javah'
cpp flags : '-I/usr/lib/jvm/java-6-sun-1.6.0.20/jre/../include -I/usr/lib/jvm/java-6-sun-1.6.0.20/jre/../include/linux'
java libs : '-L/usr/lib/jvm/java-6-sun-1.6.0.20/jre/lib/amd64/server -L/usr/lib/jvm/java-6-sun-1.6.0.20/jre/lib/amd64 -L/usr/lib/jvm/java-6-sun-1.6.0.20/jre/../lib/amd64 -L -L/usr/java/packages/lib/amd64 -L/usr/lib64 -L/lib64 -L/lib -L/usr/lib -ljvm'
checking whether JNI programs can be compiled... yes
checking JNI data types... configure: error: One or more JNI types differ from the corresponding native type. You may need to use non-standard compiler flags or a different compiler in order to fix …Run Code Online (Sandbox Code Playgroud) 我有一个非常常见的问题,即 rJava 无法在 Ubuntu 上正确安装。此问题已在此处、此处、此处等多个地方讨论过。
基本问题是,在安装rJava包时,产生以下错误信息
configure: error: Unable to run a simple JNI program. Make sure you have configured R with Java support (see R documentation) and check config.log for failure reason.
Warning in system(cmd) : error in running command
ERROR: configuration failed for package ‘rJava’
* removing ‘/home/jonno/R/x86_64-pc-linux-gnu-library/3.6/rJava’
Run Code Online (Sandbox Code Playgroud)
这个问题有各种密切相关的解决方案。它们中的大多数sudo R CMD javareconf用于为 R 配置 Java(也是一个-e变体)。有些人建议JAVA_HOME在环境变量中设置路径(其他人说不要)。其他人建议卸载并重新安装 R,而其他人建议从 …