From l.rubusch at web.de  Tue Apr 18 04:58:51 2006
From: l.rubusch at web.de (Lothar Rubusch)
Date: Tue, 18 Apr 2006 04:58:51 +0200
Subject: [Rd] cannot load rJava in R
Message-ID: <1712243834@web.de>


> -----Urspr?ngliche Nachricht-----
> Von: Simon Urbanek <simon.urbanek at r-project.org>
> Gesendet: 17.04.06 18:41:52
> An: Lothar Rubusch <l.rubusch at web.de>
> CC: r-devel at r-project.org
> Betreff: Re: [Rd] cannot load rJava in R


> Lothar,
> 
> as per posting guide, please discuss issues with contributed packages  
> with the maintainer.
> 
> On Apr 15, 2006, at 4:59 PM, Lothar Rubusch wrote:
> 
> >  I recently tried to install the rJava package on my notebook  
> > (Debian Etch / Kernel 2.6.15 / jdk 1.5.0-5 / R 2.2.1 / rJava ?? the  
> > repo one, have a look below). I compiled R myself with "--with- 
> > readline=no" and "--enable-R-shlib flags". Now, each time loading  
> > the library rJava I encouter the same error. I reinstalled several  
> > times (as root), always the same problem:
> > JNI_GetCreatedJavaVMs is undefined, isn't it?! I couldn't find  
> > anything to that problem so far..
> >
> > What went wrong?
> > Do I have the recent repository for rJava?
> > How can I fix this?
> >
> 
>  From the configure output it seems as if you have a fake libjvm.so,  
> because there are no library paths and yet it compiles. Please make  
> sure that the correct java, javac etc. are on your PATH before you  
> compile the package. Also make sure that your Java is properly  
> installed (preferably from a Debian package). If that doesn't help,  
> please send me your config.log.
> 
> Cheers,
> Simon
> 



Hey all!


Thank you for giving me the hint and for your very friendly help, I appreciate!! - True, true reading 
error messages in some case might be helpful.. Here is what I found out:

In brief LD_LIBRARY_PATHS was not set up correctly. It has to be set to the path of the shared 
objects depending on where someone has installed the JDK. I installed it under /usr/local/java/current/ 
so for me that's:
/usr/local/java/current/jre/lib/i386/
/usr/local/java/current/jre/lib/i386/client/

But this was not sufficient, R asked for another rJava.so so I had to add the following path, too (that's where I found the shared object using locate):
/usr/local/lib/R/site-library/rJava/libs/

In conclusion this line did the job:
#export LD_LIBRARY_PATH=/usr/local/java/current/jre/lib/i386/:/usr/local/java/current/jre/lib/i386/client/:/usr/local/lib/R/site-library/rJava/libs/

Now it runs smoothly! Nice!

Best regards,
Lothar



PS:
Some words on the official debian java packages: I can't consider if this still is the state of the art, but I could not find anything that it already has changed. Generally there might be some policy problems with SUN's Java packages and Debian. So the Debian packages (e.g. java-common) afaik are using Blackdown's Java implementations, in Java Version 1.4.2. But with a dummy package it is possible to do a workaround:
http://www.debian.org/doc/manuals/debian-java-faq/ch11.html#s11.2
Thus afaik it is - at least - not always possible to resist only on the official .deb files for Java.



[Rd] cannot load rJava in R
Lothar Rubusch