Benutzer:Krogmann/R from Java

Aus SDQ-Wiki

--> use svn://141.3.52.13/code/Palladio.Wrapper/trunk/org.rosuda.JRI

Troubleshoot for JRI

  • Problem: java.lang.UnsatisfiedLinkError: ..\library\rJava\jri\jri.dll: Can't find dependent libraries
  • Solution:
    • set R_HOME to e.g. "C:\Program Files\R\R-2.8.0\bin\";
    • The environment variable R_HOME has to be set globally for the system, not only for the current user (restart of the system!)
    • Use JVM argument -Djava.library.path="C:\Program Files\R\R-2.8.0\library\rJava\jri"
    • Set Path to "C:\Program Files\R\R-2.8.0\library\rJava\jri";"C:\Program Files\R\R-2.8.0\bin"

Run R JRI Examples

running the examples in $R_HOME/library/rJava/jri:

cd C:\Program Files\R\R-2.8.0\library\rJava\jri
set PATH=%PATH%;C:\Program Files\R\R-2.8.0\bin
java -cp JRI.jar;examples rtest

Paths for R 2.6.1 (German Windows XP)

cd C:\Programme\R\R-2.6.1\library\rJava\jri
set PATH=%PATH%;C:\Programme\R\R-2.6.1\bin

JVM crashes when executing the JRI examples

If R / JVM crashes, find the reason:

java -cp JRI.jar;examples rtest --zero-init

Solution: Sometimes the variables R_HOME causes trouble: If set, the JVM crashes. UNset the system variable in that case.