[R] Using JRI and Java 1.6 on MAC OS X

Prof Brian Ripley ripley at stats.ox.ac.uk
Sat Feb 28 12:21:40 CET 2009


There is no fundamental problem with rJava/JRI and Java 1.6: Java 1.6 
is all that will work on 64-bit Linux and AMD Solaris platforms, so 
some of us have only used Java 1.6 for years.

This is really an issue for the R-sig-mac list and/or the rJava 
maintainer (but he is travelling at present).  But did you install 
rJava from the sources (you may need to)?

Perhaps it is worth reiterating that most of the R Mac experts, 
(including the maintainers) do _not_ read R-help regularly (if at 
all).  If you want Mac-specific help, you are strongly advised to use 
R-sig-mac.

On Fri, 27 Feb 2009, dobomode wrote:

> Dear R-Help,
>
> I am trying to get JRI (the rJava interface allowing Java to connect
> to R) to work. I was able to run it a week ago when I was doing some
> testing using Java 1.5. However, I am developing a GUI application
> using some of the new Java 1.6 features and I just can't get JRI to
> work with this setup.
>
> Here is what I get:
>
> Cannot find JRI native library!
> Please make sure that the JRI native library is in a directory listed
> in java.library.path.
>
> java.lang.UnsatisfiedLinkError: /Library/Frameworks/R.framework/
> Versions/2.8/Resources/library/rJava/jri/libjri.jnilib:
>        at java.lang.ClassLoader$NativeLibrary.load(Native Method)
>        at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1822)
>        at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1739)
>        at java.lang.Runtime.loadLibrary0(Runtime.java:823)
>        at java.lang.System.loadLibrary(System.java:1030)
>        at org.rosuda.JRI.Rengine.<clinit>(Rengine.java:9)
>        at mfa.mes.gui.MESFrame.initR(MESFrame.java:79)
>        at mfa.mes.gui.MESFrame.<init>(MESFrame.java:313)
>        at mfa.mes.MES.main(MES.java:131)
> Java Result: 1
>
> Notice that it did actually find the JRI.jar library.

Hmm, I think you missed the word 'native', and I believe the message 
really means 'cannot find and load the JRI native library'. See what 
libjri.jnilib is linking to.

I'm not familiar enough with this on Macs, but on a normal Unix-alike 
(no frameworks etc) you usually need to reinstall R or use R CMD 
javareconf when you change the Java installation (as we know only too 
well having been struggling to get Sun Java 1.6.0_u12 to work on 
Fedora 10).

> The error seems to be related to the native JNI. I have set my java 
> library path and R_HOME correctly.
>
> I saw this entry in the changelog for rJava:
>
> 0.4-10  2006-09-14
>    o   Removed obsolete JNI 1.1 support that is no longer provided
>        in JDK 1.6 and thus prevented rJava from being used with JDK
> 1.6
>
> I am curious if this change has been applied to JRI as well. It would
> be very unfortunate if JRI is incompatible with the latest JDK.

So, please read the sources and check for yourself.  That is all 
anyone except the maintainer can do (he might remember, but he might 
want to read the sources too).

> I am running NetBeans / JDK 1.6 on Mac OS X 10.5.6.
>
> Any help would be greatly appreciated!
>
> Dobo


-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595




More information about the R-help mailing list