install rJava - quot;configure: error: One or more JNI types differ from the corresponding native typequot;(安装 rJava -“配置:错误:一种或多种 JNI 类型与相应的本机类型不同)
问题描述
I have came across this problem while installing rJava on R3.0.1: "configure: error: One or more JNI types differ from the corresponding native type"
The detailed message is attached below. I searched for similar problems but my issue is a little trickier and many proposed solutions either didnt work or I could not try, because I am working on a server which I do not have write access to system libraries.
OS: Linux 2.6.18-348.6.1.el5 #1 SMP Tue May 21 15:44:27 EDT 2013 x86_64 x86_64 x86_64 GNU/Linux (info given by typing "uname -a" sorry I couldn't quite understand this info)
R: R3.0.1, I downloaded the source, put in my home directory, and built R from source.
rJava: I ran 'install.packages("rJava")', during installation I got:
=========================
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-1.7.0-openjdk-1.7.0.9.x86_64/jre/../include -
I/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.9.x86_64/jre/../include/linux'
java libs : '-L/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.9.x86_64/jre/lib/amd64/se
rver -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 this.
ERROR: configuration failed for package 'rJava'
* removing '/home/me/R-3.0.1/library/rJava'
==================================
Since I can only access the server remotely, I do not have write access to anything outside my home directory /home/me.
Any information would be highly appreciated!
I ran into the same problem trying to install.packages("rJava")
in R version 3.0.2, as long as I tried to install as ordinary user (Linux, Debian). There was no problem running install.packages("rJava")
as root. Then, trying library(rJava)
worked for root but not for me as a user:
Error : .onLoad failed in loadNamespace() for 'rJava', details:
call: dyn.load(file, DLLpath = DLLpath, ...)
error: unable to load shared object '/usr/usr.local.original.Debian/lib/R/site-library/rJava/libs/rJava.so':
libjvm.so: cannot open shared object file: No such file or directory
This problem required to add the environment variables JAVA_HOME
and LD_LIBRARY_PATH
to ~/.login
(following instructions found at Trouble in Setting Java Environment Path on Ubuntu (libjvm.so: cannot open shared object file: No such file or directory)):
setenv JAVA_HOME /usr/lib/jvm/java-7-oracle/
setenv LD_LIBRARY_PATH $JAVA_HOME/jre/lib/amd64:$JAVA_HOME/jre/lib/amd64/server
# For c-shell; for bash, it would have to be:
export JAVA_HOME=/usr/lib/jvm/java-7-oracle/
export LD_LIBRARY_PATH=$JAVA_HOME/jre/lib/amd64:$JAVA_HOME/jre/lib/amd64/server
So, you would have to have a system administrator install rJava for you, then set your environment variables and, of course, set your own .libPaths()
in R such as to find rJava.
这篇关于安装 rJava -“配置:错误:一种或多种 JNI 类型与相应的本机类型不同"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:安装 rJava -“配置:错误:一种或多种 JNI 类型与相应的本机类型不同"
基础教程推荐
- Spring Boot Freemarker从2.2.0升级失败 2022-01-01
- 首次使用 Hadoop,MapReduce Job 不运行 Reduce Phase 2022-01-01
- 如何使用 Eclipse 检查调试符号状态? 2022-01-01
- 如何在不安装整个 WTP 包的情况下将 Tomcat 8 添加到 Eclipse Kepler 2022-01-01
- 由于对所需库 rt.jar 的限制,对类的访问限制? 2022-01-01
- 如何使用 Stream 在集合中拆分奇数和偶数以及两者的总和 2022-01-01
- 在螺旋中写一个字符串 2022-01-01
- 如何强制对超级方法进行多态调用? 2022-01-01
- Java 中保存最后 N 个元素的大小受限队列 2022-01-01
- 如何对 HashSet 进行排序? 2022-01-01