问题描述
Mac OS 10.8.4,R 3.1.0,rJava 0.9.6,RStudio 0.98
Mac OS 10.8.4,R 3.1.0,rJava 0.9.6,RStudio 0.98
我想从源代码编译rJava,以便它可以运行Java 1.7,最好在RStudio中运行.阅读了许多网站,其中提供有关重新配置R for 1.7和设置编译器标志的建议( ),但是当我尝试install.packages("rJava",type ='source')时,我继续遇到:
I would like to compile rJava from source so that it can run Java 1.7, ideally from within RStudio. Have read a number of websites giving advice about reconfiguring R for 1.7 and setting compiler flags (how to get rJava 0.9-3 to work on OS X 10.7.4 with Oracle Java 1.7?), but when I try install.packages("rJava",type='source'), I continue to run into:
...正在检查JNI数据类型...配置:错误:一种或多种JNI类型与相应的本机类型不同.您可能需要使用非标准的编译器标志或其他编译器来解决此问题.错误:软件包"rJava"的配置失败
... 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’
任何建议将不胜感激.
更新1:
根据以前的帖子,在我的〜/.bashrc中设置
From previous postings, in my ~/.bashrc, I set
export PATH ="$ PATH:$ JAVA_HOME/bin"
export PATH="$PATH:$JAVA_HOME/bin"
这使我克服了JNI错误,但是现在我遇到了
This got me past the JNI error, but now I am encountering
make -C src JRI.jar
/Library/Java/JavaVirtualMachines/jdk1.7.0_21.jdk/Contents/Home/jre/bin/javac -target 1.4 -source 1.4 -d . ../Mutex.java ../RBool.java ../RConsoleOutputStream.java ../REXP.java ../RFactor.java ../RList.java ../RMainLoopCallbacks.java ../RVector.java ../Rengine.java ../package-info.java
Error: Could not find or load main class com.sun.tools.javac.Main
make[2]: *** [org/rosuda/JRI/Rengine.class] Error 1
make[1]: *** [src/JRI.jar] Error 2
make: *** [jri] Error 2
ERROR: compilation failed for package ‘rJava’
* removing ‘/Library/Frameworks/R.framework/Versions/3.1/Resources/library/rJava’
其他网站建议调用"unpack200 -r -v -l""tools.pack tools.jar",但jdk发行版中似乎不再包含tools.pack.
Other websites suggest calling "unpack200 -r -v -l "" tools.pack tools.jar", but tools.pack doesn't appear to be included in jdk releases, anymore.
任何建议将不胜感激!谢谢!
Any advice would be greatly appreciated!Thank you!
推荐答案
我希望这能回答您的问题:我在mac os x 10.10.3上,并且在安装需要rJava的软件包之一时遇到了问题.我执行了以下操作,并尝试从RStudio重新安装,并且可以正常工作.
I hope this answers your question: I am on mac os x 10.10.3 and I had issues with installing one of the packages that required rJava). I did the following and tried to reinstall from RStudio and it worked.
sudo R CMD javareconf
sudo find /Library/Frameworks/R.framework/Resources/etc -type f -exec chmod 664 "{}" \;
这篇关于在Mac上为Java 1.7编译rJava的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!