如何让rJava在OS X上使用不同的JRE?

时间:2016-04-28 12:53:36

标签: java r macos rjava

我在OS X 10.5上运行R 3.2.4,并安装了多个Java。我目前使用JDK 7作为默认安装。使用R CMD javareconf,所有内容都会正确配置:

guhar@NCATS-1850784-M:~/src/cdkr [master*]$ R CMD javareconf JAVA_CPPFLAGS='-I/Library/Java/JavaVirtualMachines/jdk1.7.0_71.jdk/Contents/Home/include/'
Java interpreter : /Library/Java/JavaVirtualMachines/jdk1.7.0_71.jdk/Contents/Home/jre/bin/java
Java version     : 1.7.0_71
Java home path   : /Library/Java/JavaVirtualMachines/jdk1.7.0_71.jdk/Contents/Home
Java compiler    : /Library/Java/JavaVirtualMachines/jdk1.7.0_71.jdk/Contents/Home/bin/javac
Java headers gen.: /Library/Java/JavaVirtualMachines/jdk1.7.0_71.jdk/Contents/Home/bin/javah
Java archive tool: /Library/Java/JavaVirtualMachines/jdk1.7.0_71.jdk/Contents/Home/bin/jar
System Java on OS X

trying to compile and link a JNI program 
detected JNI cpp flags    : -I/Library/Java/JavaVirtualMachines/jdk1.7.0_71.jdk/Contents/Home/include/
detected JNI linker flags : -framework JavaVM
clang -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/Library/Java/JavaVirtualMachines/jdk1.7.0_71.jdk/Contents/Home/include/ -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include    -fPIC  -Wall -mtune=core2 -g -O2  -c conftest.c -o conftest.o
clang -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Library/Frameworks/R.framework/Resources/lib -L/usr/local/lib -o conftest.so conftest.o -framework JavaVM -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation


JAVA_HOME        : /Library/Java/JavaVirtualMachines/jdk1.7.0_71.jdk/Contents/Home
Java library path: 
JNI cpp flags    : -I/Library/Java/JavaVirtualMachines/jdk1.7.0_71.jdk/Contents/Home/include/
JNI linker flags : -framework JavaVM
Updating Java configuration in /Library/Frameworks/R.framework/Resources
Done.

然后我安装rJava 0.98并且没有报告错误。但是,当我启动R并使用rJava时,它表示java.version系统属性(表示JRE版本)为1.6,即使JAVA_HOME设置为我的JDK 7安装:< / p>

> library(rJava)
> .jinit()
> .jcall("java/lang/System","S","getProperty","java.version")
[1] "1.6.0_65"

我需要在rJava方面设置一些内容才能识别我的JAVA_HOME设置吗?或者这是否需要在OS X环境中设置?

0 个答案:

没有答案