[R] R and Java

Andrew Schuh andys at neptuneandco.com
Tue Oct 2 18:26:10 CEST 2001


Olivier Martin wrote:

> Daer all,
>
> Before to expose my problem, this the configuartion of my environment.
>
> I use the version 1.2.1 of R  with a  limux system (redhat)
>
> I have installed SJava  (from omeghat) package successfully.
> So, i wanted to try an example (calc.R) that is provided in the
> library.
> This is the message I obtained:
> Error in isJavaInitialized("Java virtual machine has not been
> initialized. Call .JavaInit
> Java virtual machine has not been initialized. Call .JavaInit()
>
> So, i tried .JavaInit() but i obtained Segmentation fault (core
> dumped)
>
> Could somebody  help me ?
> Thanks,
> Olivier
>
> --
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> Olivier MARTIN
> PhD student                  phone: (33) 04 76 61 53 55
> Projet IS2                               06 08 67 93 42
> INRIA Rhone-Alpes            fax  : (33) 04 76 61 54 77
> 655, Av. de l'Europe
> Montbonnot                   e-mail:olivier.martin at inrialpes.fr
> 38334 Saint Ismier cedex
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
>
>

I finally got it running (sorta) on my RH7.1.  I would make sure you
have the latest package from Omegahat first.  Then, I believe the  most
likely culprit is the LD_LIBRARY_PATH env variable.  Mine includes the
following (my bash profile).


LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/lib/R/library/SJava/libs:/opt/IBMJava2-13/jre/bin:

/opt/IBMJava2-13/jre/bin/classic:/usr/lib:/usr/local/lib/R/bin:/usr/local/lib/R/library/SJava/org/omegahat/Jars/ROmegahatExamples.jar:.;
export LD_LIBRARY_PATH

You can replace the java directories with the jdk you are using.  Also
make sure that error messages aren't pointing you to a '.so' (in the
libs directory of SJava) that you don't have.  I had to rename one of
them in an earlier version of the SJava package.

Even with this, I am only able to run an example after I run java at
least once.  I would open the BASH shell and run any java class and then
open R and be able to run the examples (
library(SJava);.JavaInit();source(....example.r);example.r();  )  .
This makes it a little difficult to use the package (or at the least,
inelegant) by running R in batch.  I have had a lot of difficulty
creating any original code with this package.  My goal was to create
some original code to allow me to run a java app that called R.  Not
much luck.  I put a message out some time ago but I haven't had much
luck getting responses.  If anyone out there has had any luck using this
package with Redhat and IBM JDK please let me know.  Hope this helps.

For the future, the omegahat help list would probably be a better place
to put this.  Although I realize that list doesn't get nearly as much
feedback as this one.


--
Andrew Schuh
Environmental Mathematician

Neptune and Co, Inc.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://stat.ethz.ch/pipermail/r-help/attachments/20011002/5618bdd2/attachment.html


More information about the R-help mailing list