[stats-rosuda-devel] rJava on OS X 10.7.4 with Oracle Java 1.7?

Casasent,Tod D TDCasasent at mdanderson.org
Wed Nov 28 21:42:13 CET 2012


Thanks--I need Java 1.7 since I'm making use of the new fork/join
functionality on our cluster here. I'll try this out and report back.

I guess the Windows and Linux installs don't have this same issue? Using
the same install process, we run rJava and Java 1.7 on both Windows and
Linux just fine.

Thanks,
Tod

On 11/28/12 2:30 PM, "Simon Urbanek" <simon.urbanek at r-project.org> wrote:

>Tod,
>
>you are using the *binary* which is compiled against system Java (which
>on your system is 1.6) - so if you remove Java 1.6 you'll break it. If
>you want to use Java 1.7, you'll have to re-configure R for Java 1.7 and
>re-compile rJava to use those settings. Note hat Oracle's Java lives in
>an entirely different place
>(/Library/Java/JavaVirtualMachines/jdk1.7.0_09.jdk) than the system Java
>(/System/Library/Frameworks/JavaVM.framework), so it is not
>interchangeable.
>
>In addition, Oracle Java 1.7 it is not a framework, it's a big mess that
>was not really designed for OS X, so you have to set it by hand to
>settings like on Linux - it's pretty painful. Also it requires overrides
>... so if you really want to go down the rabbit hole, this is what worked
>for me:
>
>JAVA_LD_LIBRARY_PATH=/Library/Java/JavaVirtualMachines/jdk1.7.0_09.jdk/Con
>tents/Home/jre/lib/server
>JAVA_LIBS='-L/Library/Java/JavaVirtualMachines/jdk1.7.0_09.jdk/Contents/Ho
>me/jre/lib/server -ljvm'
>JAVA_CPPFLAGS='-I/Library/Java/JavaVirtualMachines/jdk1.7.0_09.jdk/Content
>s/Home/include 
>-I/Library/Java/JavaVirtualMachines/jdk1.7.0_09.jdk/Contents/Home/include/
>darwin' R64 CMD javareconf
>
>Then install rJava from sources (R64 ->
>install.packages("rJava",type='source')). Note that it's 64-bit only, so
>it will only work with 64-bit R.
>
>Cheers,
>Simon
>
>
>On Nov 28, 2012, at 11:54 AM, "Casasent,Tod D"
><TDCasasent at mdanderson.org> wrote:
>
>> Is there anyone out there who has managed to get rJava 0.9-3 to work on
>>OS X 10.7.4 with Oracle Java 1.7?
>> 
>> R version 2.15.2 (2012-10-26) -- "Trick or Treat"
>> Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit)
>> 
>> java version "1.7.0_09"
>> Java(TM) SE Runtime Environment (build 1.7.0_09-b05)
>> Java HotSpot(TM) 64-Bit Server VM (build 23.5-b02, mixed mode)
>> 
>> I've installed rJava using both the install.packages function and the
>>command line install with R 2.15.2. I don't get any errors.
>> 
>> $ R CMD INSTALL rJava
>> * installing to library
>>Œ/Library/Frameworks/R.framework/Versions/2.15/Resources/library¹
>> * installing *binary* package ŒrJava¹ ...
>> 
>> * DONE (rJava)
>> $ 
>> 
>> If I use Java Preferences to put 1.7 first on the list, but leave 1.6
>>"on", rJava always starts 1.6.
>> 
>> If I use Java Preferences to put 1.7 first and turn off 1.6, rJava does
>>this:
>> 
>> > library(rJava)
>> > .jinit()
>> JavaVM: requested Java version ((null)) not available. Using Java at ""
>>instead.
>> JavaVM: Failed to load JVM: /bundle/Libraries/libserver.dylib
>> JavaVM FATAL: Failed to load the jvm library.
>> Error in .jinit() : JNI_GetCreatedJavaVMs returned -1
>> > 
>> 
>> However, using the system function, R by itself finds Java 1.7.
>> 
>> > system("java -version")
>> java version "1.7.0_09"
>> Java(TM) SE Runtime Environment (build 1.7.0_09-b05)
>> Java HotSpot(TM) 64-Bit Server VM (build 23.5-b02, mixed mode)
>> > 
>> 
>> Does 1.7 need a special entry in /System/Library/Java/JavaConfig.plist ?
>> 
>> Does the Versions directory need tweaking for 1.7 ? It is weird that
>>Current goes to A, which ends up with 1.7 while CurrentJDK is mapped to
>>1.6
>> 
>> $cd /System/Library/Frameworks/JavaVM.framework/Versions/
>> $ls -la
>> total 64
>> drwxr-xr-x  11 root  wheel  374 Sep 26 10:10 .
>> drwxr-xr-x  11 root  wheel  374 Nov 26 09:24 ..
>> lrwxr-xr-x   1 root  wheel   10 Sep 26 10:09 1.4 -> CurrentJDK
>> lrwxr-xr-x   1 root  wheel   10 Sep 26 10:09 1.4.2 -> CurrentJDK
>> lrwxr-xr-x   1 root  wheel   10 Sep 26 10:09 1.5 -> CurrentJDK
>> lrwxr-xr-x   1 root  wheel   10 Sep 26 10:09 1.5.0 -> CurrentJDK
>> lrwxr-xr-x   1 root  wheel   10 Sep 26 10:09 1.6 -> CurrentJDK
>> lrwxr-xr-x   1 root  wheel   10 Sep 26 10:09 1.6.0 -> CurrentJDK
>> drwxr-xr-x   8 root  wheel  272 Nov 26 09:24 A
>> lrwxr-xr-x   1 root  wheel    1 Sep 26 10:09 Current -> A
>> lrwxr-xr-x   1 root  wheel   59 Sep 26 10:09 CurrentJDK ->
>>/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents
>> 
>> Even with R CMD javareconf run with the path pointing to the 1.7 files
>>directly or to the /usr/bin/java paths, rJava still can't find or start
>>Java 1.7.
>> 
>> Does 1.7 need the JAVA_LD_LIBRARY_PATH variable set?
>> 
>> Makeconf:JAVA = /usr/bin/java
>> Makeconf:JAVAC = /usr/bin/javac
>> Makeconf:JAVAH = /usr/bin/javah
>> Makeconf:JAVA_HOME =
>>/Library/Java/JavaVirtualMachines/jdk1.7.0_09.jdk/Contents/Home/jre
>> Makeconf:JAVA_LD_LIBRARY_PATH =
>> Makeconf:JAVA_LIBS = -framework JavaVM
>> Makeconf:JAVA_CPPFLAGS = -I$(JAVA_HOME)/include
>> 
>> Makeconf:JAR = 
>>/Library/Java/JavaVirtualMachines/jdk1.7.0_09.jdk/Contents/Home/bin/jar
>> Makeconf:JAVA = 
>>/Library/Java/JavaVirtualMachines/jdk1.7.0_09.jdk/Contents/Home/jre/bin/j
>>ava
>> Makeconf:JAVAC =
>>/Library/Java/JavaVirtualMachines/jdk1.7.0_09.jdk/Contents/Home/bin/javac
>> Makeconf:JAVAH =
>>/Library/Java/JavaVirtualMachines/jdk1.7.0_09.jdk/Contents/Home/bin/javah
>> Makeconf:JAVA_HOME =
>>/Library/Java/JavaVirtualMachines/jdk1.7.0_09.jdk/Contents/Home/jre
>> Makeconf:JAVA_LD_LIBRARY_PATH =
>> Makeconf:JAVA_LIBS = -framework JavaVM
>> Makeconf:JAVA_CPPFLAGS = -I$(JAVA_HOME)/include
>> 
>> Thanks for any help,
>> Tod Casasent
>> _______________________________________________
>> stats-rosuda-devel mailing list
>> stats-rosuda-devel at listserv.uni-augsburg.de
>> http://mailman.rz.uni-augsburg.de/mailman/listinfo/stats-rosuda-devel
>





More information about the stats-rosuda-devel mailing list