Skip to content

Using JRI and Java 1.6 on MAC OS X

3 messages · dobomode, Brian Ripley, Dobo Radichkov

#
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. 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.

I am running NetBeans / JDK 1.6 on Mac OS X 10.5.6.

Any help would be greatly appreciated!

Dobo
#
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:

            
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).
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).

  
    
#
Thank you Prof. Ripley,

Since I needed to build a prototype very quickly, I ended up using  
Rserve. I found it actually easier to use & setup with a couple of  
caveats (make sure to use the latest jave-new client from the Rserve  
sources from the rforge website ? the version on rosuda.org seems to  
be out of date). An added benefit is that Rserve is actively being  
developed vs JRI (latest Rserve version is from 1/2009, JRI ? 2006).

Thanks,

Dobo