当我运行install.packages(" rJava")
时错误: -
checking whether siglongjmp is declared... yes
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 : ''
java libs : ''
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/lib64/R/library/rJava’
The downloaded source packages are in
‘/tmp/Rtmpyht6l8/downloaded_packages’
Updating HTML index of packages in '.Library'
Making 'packages.html' ... done
Warning message:
In install.packages("rJava", "/usr/lib64/R/library", repos = "http://ftp.iitm.ac .in/cran/") :
installation of package ‘rJava’ had non-zero exit status
我跑了R CMD javareconf -e
Java interpreter : /usr/bin/java
Java version : 1.8.0_91
Java home path : /usr/java/jdk1.8.0_91/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/linux
detected JNI linker flags : -L$(JAVA_HOME)/lib/amd64/server -ljvm
gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG -I/usr/java/jdk1.8.0_91/jre/../include -I/usr/java/jdk1.8.0_91/jre/../include/linux -I/usr/local/include -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -fpic -fPIC -c conftest.c -o conftest.o
gcc -m64 -std=gnu99 -shared -L/usr/lib64/R/lib -ldl -lpthread -lc -lrt -lcurl -lidn -lssh2 -lssl -lcrypto -lssl -lcrypto -ldl -lz -lgssapi -lldap -lz -lrt -o conftest.so conftest.o -L/usr/java/jdk1.8.0_91/jre/lib/amd64/server -ljvm -L/usr/lib64/R/lib -lR
/usr/bin/ld: cannot find -lcurl
collect2: ld returned 1 exit status
make: *** [conftest.so] Error 1
Unable to compile a JNI program
已导出以下Java变量:
还导出JAVA_HOME = jdk_path
有人可以帮助我吗?
答案 0 :(得分:0)
在你的工作站安装最新的java版本并在Rstudio中设置java主页,我认为它可以工作
Sys.setenv(JAVA_HOME="C:\\Program Files\\Java\\jre7")