[R] calling R from within Java, using jri

From: <john.gavin_at_ubs.com>
Date: Thu 28 Sep 2006 - 11:42:25 GMT


Hi,

I want to call R from within Java, using jri as per http://www.rosuda.org/software/jri/
So I am following the instructions in the README file for JRI 0.2-4.

I have run 'sh configure.win' and 'make' and they seemed to be successful.
(See below for the output from make, for example.) But when I try 'run.bat rtest' (with and without R command line arguments)
the output that I get is

'c:\temp\r\jri>C:/PROGRA~1/Java/JDK15~1.0_0/bin/java -cp .;examples;src/JRI.jar rtest $*
Creating Rengine (with arguments)'

That suggests that it gets to line 60 in rtest.java then stops on line 61,
without producing an error. Line 61 is

Rengine re=new Rengine(args, false, null);

so it seems that I am not able to construct an Rengine. Can someone suggest what I might try next to track down the problem, please?

I am running Java JDK 1.5.0 and R 2.3.1 on Windows NT.

Regards,

John.

John Gavin <john.gavin@ubs.com>,
Commodities, FIRC,
UBS Investment Bank, 2nd floor,
100 Liverpool St., London EC2M 2RH, UK.
Phone +44 (0) 207 567 4289

c:\temp\r\jri>make
make -C src JRI.jar
make[1]: Entering directory `/cygdrive/c/temp/r/jri/src' gcc -c -o Rengine.o Rengine.c -DWin32 -D_JNI_IMPLEMENTATION_
-IC:/PROGRA~1/Java/JDK15~1.0_0/include
-IC:/PROGRA~1/Java/JDK15~1.0_0/include/win32 -IC:/etc/R/R-2.3.1/include
gcc -c -o jri.o jri.c -DWin32 -D_JNI_IMPLEMENTATION_
-IC:/PROGRA~1/Java/JDK15~1.0_0/include
-IC:/PROGRA~1/Java/JDK15~1.0_0/include/win32 -IC:/etc/R/R-2.3.1/include
gcc -c -o Rcallbacks.o Rcallbacks.c -DWin32 -D_JNI_IMPLEMENTATION_
-IC:/PROGRA~1/Java/JDK15~1.0_0/include
-IC:/PROGRA~1/Java/JDK15~1.0_0/include/win32 -IC:/etc/R/R-2.3.1/include
gcc -c -o Rinit.o Rinit.c -DWin32 -D_JNI_IMPLEMENTATION_
-IC:/etc/R/R-2.3.1/include

Rinit.c: In function `initR':
Rinit.c:265: warning: assignment from incompatible pointer type gcc -c -o globals.o globals.c -DWin32 -D_JNI_IMPLEMENTATION_
-IC:/PROGRA~1/Java/JDK15~1.0_0/include
-IC:/PROGRA~1/Java/JDK15~1.0_0/include/win32
gcc -o jri.dll Rengine.o jri.o Rcallbacks.o Rinit.o globals.o win32/libjvm.dll.a -shared -Lwin32 -ljvm
-LC:/etc/R/R-2.3.1/src/gnuwin32 -LC:/etc/R/R-2.3.1/bin -lR -Wl,--kill-at

Info: resolving _R_CStackLimit by linking to __imp__R_CStackLimit (auto-import)

C:/PROGRA~1/Java/JDK15~1.0_0/bin/javac -d . ../Mutex.java ../REXP.java
../RMainLoopCallbacks.java ../Rengine.java 
C:/PROGRA~1/Java/JDK15~1.0_0/bin/jar fc JRI.jar org jri.dll 
make[1]: Leaving directory `/cygdrive/c/temp/r/jri/src' rm -f jri.dll
cp src/jri.dll jri.dll
C:/PROGRA~1/Java/JDK15~1.0_0/bin/javac -classpath src/JRI.jar -d examples examples/rtest.java
Note: examples/rtest.java uses or overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details. C:/PROGRA~1/Java/JDK15~1.0_0/bin/javac -classpath src/JRI.jar -d examples examples/rtest2.java
Note: examples/rtest2.java uses or overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details. echo "set PATH=%PATH%;C:/etc/R/R-2.3.1\\bin;C:/etc/R/R-2.3.1\\lib" > run.bat
echo "C:/PROGRA~1/Java/JDK15~1.0_0/bin/java -cp .;examples;src/JRI.jar rtest \$*" >> run.bat
This communication is issued by UBS AG and/or affiliates to institutional investors; it is not for private persons. This is a product of a sales or trading desk and not the Research Dept. Opinions expressed may differ from those of other divisions of UBS, including Research. UBS may trade as principal in instruments identified herein and may accumulate/have accumulated a long or short position in instruments or derivatives thereof. UBS has policies designed to negate conflicts of interest. This e-mail is not an official confirmation of terms and unless stated, is not a recommendation, offer or solicitation to buy or sell. Any prices or quotations contained herein are indicative only. Communications may be monitored.

  2006 UBS. All rights reserved.
Intended for recipient only and not for further distribution without the consent of UBS.



R-help@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 and provide commented, minimal, self-contained, reproducible code. Received on Thu Sep 28 21:47:51 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Thu 28 Sep 2006 - 12:30:07 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.