[R] Can rJava connect with Oracle JDK7 on Mac OS X?

Osamu Ogasawara osamu.ogasawara at gmail.com
Sun Mar 9 12:32:24 CET 2014


Hello,
I'm writing a program that provide an interactive interface between R and JavaFX (2.2+),
https://github.com/oogasawa/rjfx.chart
on the top of the rJava package.
This program works fine on Linux and MS-Windows, but it does not work on Mac OS X.
The reason seems that rJava on Mac OS X ignores JAVA_HOME environment variable,
and uses JDK distributed by Appele (now it's version is 1.6).

Since JavaFX (2.2+) requires JDK7 or higher, this means that program can not run on OS X.
Does someone knows how to get around this?

I have installed JDK7u51 from Oracle Web site:
(MacBook Pro, OS X 10.9)

$ env | grep JAVA_HOME
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home

$ java -version
java version "1.7.0_51"
Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.51-b03, mixed mode)

However, when I install the program (rjfx.chart),
R required to install JDK6 and the result is as follows:

> library("rJava")
> .jinit()
> s=.jnew("java/lang/System")
> .jcall(s, "Ljava/lang/String;", "getProperty", "java.version")
[1] "1.6.0_65"

I would like to appreciate any comments and suggestions.

Sincerely,
Osamu Ogasawara


More information about the R-help mailing list