[R] unable to source a .R file using RJava

Prof Brian Ripley ripley at stats.ox.ac.uk
Wed Jul 27 18:59:43 CEST 2005


Please, this is R-help, not the list for SJava questions.

SJava is part of the Omegahat project (not the R project) and that used to 
have its own mailing lists.  I believe they are currently non-operational, 
but please check.

The R posting guide suggests that you first ask the maintainer and then 
perhaps the R-devel list.


On Wed, 27 Jul 2005, O'Brien, Laura wrote:

> I am unable to source a ".R" file using RJava.  I tried a couple of different tests:
>     1)  using java and the evaluation method core dumps
>     2)  using ./RJava --example --gui-none to invoke source core dumps.
>     3)  The line of R works if I go directly thru R and not RJava.
>
> Version info and code are below. Any help would be appreciated.
>
> --Laura O'Brien
> Applications Architect
>
>
>
> version info
> ------------
> Java: 	j2sdk1.4.1_02
> R: 		2.1.1
> SJava:	0.68
> OS:		SunOs 5.8
>
>
> doNothing.R file I'd like to source
> -----------------------------------
>
> #
> # $Author: lobrien $
> #
> # $Date: 2005/07/27 16:20:00 $
> #
> # $Header: /unixfiles/softengr/cvs/repository/hh/src/r/doNothing.R,v 1.2 2005/07/27 16:20:00 lobrien Exp $
> #
> #
>
> #
> # test file to see if I can source a .R file via SJava
> #
> # Works when
> # ----------
> #    I invoke R version 2.1.1 on SunOS jupiter 5.8
> #  >  source ("/imports/nas1/people/lobrien/dist2.1_rc1/hh/src/r/doNothing.R")
> #  >  res <- getData("something")
> #  >  res
> #  [1] 2
> #
> #
> # doesn't work when
> # -----------------
> # (A)   launch R thru java via -->  ./RJava --example --gui-none
> #       [omegahat->R] source ("/imports/nas1/people/lobrien/dist2.1_rc1/hh/src/r/doNothing.R")
> #
> #       Unexpected Signal : 11 occurred at PC=0xFE0C2B44
> #       Function=[Unknown.  Nearest:  JVM_Close+0x6BFC4]
> #       <snip>
> #
> # (B)   call it via .java file.  See JavaRCall3
>
>
>
> getData <- function(query,
>                    db.name="csbdev",
>                    user.name="noone",
>                    passwd="pass"){
>  R <- 2
>  R
> }
>
> .java code to invoke the evaluate method
> -----------------------------------------
> package com.icoria.rwrapper;
>
> import org.omegahat.R.Java.ROmegahatInterpreter;
> import org.omegahat.R.Java.REvaluator;
>
>
> public class JavaRCall3
> {
>
>    /**
>     * want to see if I can eval a t.test command like what I would run in the
>     * R command line
>     */
>
>    static public void run_sourceRFile(REvaluator e, ROmegahatInterpreter interp)
>    {
>        /* produces a core */
>        System.err.println("running source doNothing.R");
>
>        Object value = e.eval("source (\"/imports/nas1/people/lobrien/dist2.1_rc1/hh/src/r/doNothing.R");
>        if (value != null)
>            interp.show(value);
>    }
>
>
>
>
>    /**
>     *
>     */
>    static public void main(String[] args)
>    {
>        ROmegahatInterpreter interp = new ROmegahatInterpreter(ROmegahatInterpreter.fixArgs(args), false);
>        REvaluator e = new REvaluator();
>
>        Object[] funArgs;
>        String[] objects;
>        Object value;
>        int i;
>
>        run_sourceRFile(e, interp);
>    }
> }
>
> the corresponding core dump when using java
> --------------------------------------------
> [lobrien at fox] ./RJava
> Loading RInterpreter library
>
> R : Copyright 2005, The R Foundation for Statistical Computing
> Version 2.1.1  (2005-06-20), ISBN 3-900051-07-0
>
> R is free software and comes with ABSOLUTELY NO WARRANTY.
> You are welcome to redistribute it under certain conditions.
> Type 'license()' or 'licence()' for distribution details.
>
> R is a collaborative project with many contributors.
> Type 'contributors()' for more information and
> 'citation()' on how to cite R or R packages in publications.
>
> Type 'demo()' for some demos, 'help()' for on-line help, or
> 'help.start()' for a HTML browser interface to help.
> Type 'q()' to quit R.
>
> running source doNothing.R
> Problems: unrecognized user-level object of mode 0
> Error: No default Java type for S class ???
>
> An unexpected exception has been detected in native code outside the VM.
> Unexpected Signal : 11 occurred at PC=0xF1835E50
> Function=setup_Rmainloop+0x4F8
> Library=/imports/filer04/tools/app/R-2.1.1/lib/R/lib/libR.so
>
> Current Java thread:
>        at org.omegahat.R.Java.REvaluator.eval(Native Method)
>        at org.omegahat.R.Java.REvaluator.eval(REvaluator.java:90)
>        at org.omegahat.R.Java.REvaluator.eval(REvaluator.java:40)
>        at com.icoria.rwrapper.JavaRCall3.run_sourceRFile(JavaRCall3.java:25)
>        at com.icoria.rwrapper.JavaRCall3.main(JavaRCall3.java:46
>
> Dynamic libraries:
> 0x10000         /tools/app/j2sdk1.4.1_02-20030305/j2sdk1.4.1_02/bin/java
> 0xff360000      /usr/lib/libthread.so.1
> 0xff3a0000      /usr/lib/libdl.so.1
> 0xff200000      /usr/lib/libc.so.1
> 0xff330000      /usr/platform/SUNW,Ultra-60/lib/libc_psr.so.1
> 0xfe000000      /imports/filer04/tools/app/j2sdk1.4.1_02-20030305/j2sdk1.4.1_02/jre/lib/sparc/client/libjvm.so
> 0xff2d0000      /usr/lib/libCrun.so.1
> 0xff1e0000      /usr/lib/libsocket.so.1
> 0xff100000      /usr/lib/libnsl.so.1
> 0xff0d0000      /usr/lib/libm.so.1
> 0xff300000      /usr/lib/libw.so.1
> 0xff0b0000      /usr/lib/libmp.so.2
> 0xff080000      /imports/filer04/tools/app/j2sdk1.4.1_02-20030305/j2sdk1.4.1_02/jre/lib/sparc/native_threads/libhpi.so
> 0xff050000      /imports/filer04/tools/app/j2sdk1.4.1_02-20030305/j2sdk1.4.1_02/jre/lib/sparc/libverify.so
> 0xfe7c0000      /imports/filer04/tools/app/j2sdk1.4.1_02-20030305/j2sdk1.4.1_02/jre/lib/sparc/libjava.so
> 0xff020000      /imports/filer04/tools/app/j2sdk1.4.1_02-20030305/j2sdk1.4.1_02/jre/lib/sparc/libzip.so
> 0xfdfc0000      /imports/filer04/tools/app/R-2.1.1/lib/R/library/SJava/libs/SJava.so
> 0xfdf90000      /imports/filer04/tools/app/R-2.1.1/lib/R/library/SJava/libs/libRSNativeJava.so
> 0xf1780000      /imports/filer04/tools/app/R-2.1.1/lib/R/lib/libR.so
> 0xfc7c0000      /tools/app/gcc-3.4.3/lib/libg2c.so.0
> 0xfc4e0000      /tools/app/gcc-3.4.3/lib/libgcc_s.so.1
> 0xfc4b0000      /tools/app/R-2.1.1/lib/R/library/grDevices/libs/grDevices.so
> 0xfc450000      /tools/app/R-2.1.1/lib/R/library/stats/libs/stats.so
> 0xfc430000      /tools/app/R-2.1.1/lib/R/library/methods/libs/methods.so
>
> Local Time = Wed Jul 27 12:37:24 2005
> Elapsed Time = 5
> #
> # The exception above was detected in native code outside the VM
> #
> # Java VM: Java HotSpot(TM) Client VM (1.4.1_02-b06 mixed mode)
> #
> # An error report file has been saved as /tmp/hs_err_pid22533.log.
> # Please refer to the file for further information.
> #
> Abort
>
> using ./RJava --example --gui-none to invoke source core dumps.
> ---------------------------------------------------------------
> [omegahat->R] source ("/imports/nas1/people/lobrien/dist2.1_rc1/hh/src/r/doNothing.R")
>
> Unexpected Signal : 11 occurred at PC=0xFE0C2B44
> Function=[Unknown. Nearest: JVM_Close+0x6BFC4]
> Library=/imports/filer04/tools/app/j2sdk1.4.1_02-20030305/j2sdk1.4.1_02/jre/lib/sparc/client/libjvm.so
>
> Current Java thread:
>        at org.omegahat.R.Java.REvaluator.eval(Native Method)
>        at org.omegahat.R.Java.REvaluator.eval(REvaluator.java:90)
>        at org.omegahat.R.Java.REvaluator.eval(REvaluator.java:40)
>        at org.omegahat.R.Java.Examples.JavaRPrompt.main(JavaRPrompt.java:26)
>
> Dynamic libraries:
> 0x10000         /tools/app/j2sdk1.4.1_02-20030305/j2sdk1.4.1_02/bin/java
> 0xff360000      /usr/lib/libthread.so.1
> 0xff3a0000      /usr/lib/libdl.so.1
> 0xff200000      /usr/lib/libc.so.1
> 0xff330000      /usr/platform/SUNW,Ultra-60/lib/libc_psr.so.1
> 0xfe000000      /imports/filer04/tools/app/j2sdk1.4.1_02-20030305/j2sdk1.4.1_02/jre/lib/sparc/client/libjvm.so
> 0xff2d0000      /usr/lib/libCrun.so.1
> 0xff1e0000      /usr/lib/libsocket.so.1
> 0xff100000      /usr/lib/libnsl.so.1
> 0xff0d0000      /usr/lib/libm.so.1
> 0xff300000      /usr/lib/libw.so.1
> 0xff0b0000      /usr/lib/libmp.so.2
> 0xff080000      /imports/filer04/tools/app/j2sdk1.4.1_02-20030305/j2sdk1.4.1_02/jre/lib/sparc/native_threads/libhpi.so
> 0xff050000      /imports/filer04/tools/app/j2sdk1.4.1_02-20030305/j2sdk1.4.1_02/jre/lib/sparc/libverify.so
> 0xfe7c0000      /imports/filer04/tools/app/j2sdk1.4.1_02-20030305/j2sdk1.4.1_02/jre/lib/sparc/libjava.so
> 0xff020000      /imports/filer04/tools/app/j2sdk1.4.1_02-20030305/j2sdk1.4.1_02/jre/lib/sparc/libzip.so
> 0xfdfc0000      /imports/filer04/tools/app/R-2.1.1/lib/R/library/SJava/libs/SJava.so
> 0xf1780000      /imports/filer04/tools/app/R-2.1.1/lib/R/lib/libR.so
> 0xfc7c0000      /tools/app/gcc-3.4.3/lib/libg2c.so.0
> 0xfc4e0000      /tools/app/gcc-3.4.3/lib/libgcc_s.so.1
> 0xfc4b0000      /tools/app/R-2.1.1/lib/R/library/grDevices/libs/grDevices.so
> 0xfc450000      /tools/app/R-2.1.1/lib/R/library/stats/libs/stats.so
> 0xfc430000      /tools/app/R-2.1.1/lib/R/library/methods/libs/methods.so
> 0xfa3c0000      /tools/app/R-2.1.1/lib/R/modules/R_X11.so
> 0xfc410000      /usr/lib/libSM.so.6
> 0xfa390000      /usr/lib/libICE.so.6
> 0xf1680000      /usr/lib/libX11.so.4
> 0xfa2d0000      /usr/lib/libXext.so.0
>
> Local Time = Wed Jul 27 12:39:30 2005
> Elapsed Time = 37
> #
> # HotSpot Virtual Machine Error : 11
> # Error ID : 4F530E43505002E6 01
> # Please report this error at
> # http://java.sun.com/cgi-bin/bugreport.cgi
> #
> # Java VM: Java HotSpot(TM) Client VM (1.4.1_02-b06 mixed mode)
> #
> # An error report file has been saved as /tmp/hs_err_pid22537.log.
> # Please refer to the file for further information.
> #
> Abort
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>

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