I am trying to load the JRI in my webstart-application. I always get this exception:
Cannot find JRI native library!
Please make sure that the JRI native library is in a directory listed in java.library.path.
JNLP file:
...
<resources>
...
<jar href="JRI.jar" />
...
<nativelib href="JRI.jar" />
</resources>
...
I use a batch script to run my application under Windows 7:
set R_HOME=C:\ProgramData\R\R-2.14.0
set R_PATH=C:\ProgramData\R\R-2.14.0\library\rJava\jri
set JNLP_URL=http://localhost/app/app.jnlp
set WEBSTART="C:\Program Files\Java\jre7\bin\javaws.exe"
SET PATH=%PATH%;%R_HOME%\bin\i386;%R_PATH%
%WEBSTART% %JNLP_URL%
I try to use an sh script to start my application under Linux (Ubuntu):
#!/bin/bash
export R_HOME=/usr/lib/R/
export r_home=/usr/lib/R/
export rHome=/usr/lib/R/
export rhome=/usr/lib/R/
export rHOME=/usr/lib/R/
export R_PATH=/usr/lib/R/site-library/rJava/jri/
export r_path=/usr/lib/R/site-library/rJava/jri/
export rPath=/usr/lib/R/site-library/rJava/jri/
export rPATH=/usr/lib/R/site-library/rJava/jri/
export rpath=/usr/lib/R/site-library/rJava/jri/
export WEBSTART=/usr/lib/jvm/java-7-oracle/jre/bin/javaws
export JNLP_URL=http://localhost/app/app.jnlp
export PATH=$PATH:$R_HOME/bin:$R_PATH
$WEBSTART $JNLP_URL
For some reason it does work under Windows, but not under Linux. The two batch scripts should do the same...
The application works fine under both, Windows and Linux, until I try to use a method which tries to use R.
It also works completely (including R), when I start my application with the following sh script as a non-webstart version:
#!/bin/bash
export R_HOME=/usr/lib/R/
export rPATH=/usr/lib/R/site-library/rJava/jri/
export JAVA=/usr/lib/jvm/java-7-oracle/jre/bin/java
LIB=<<Libraries>> # I left out this very long line for this post :)
$JAVA -classpath $LIB:. -Djava.library.path=./FAST:$rPATH de.app.MainWindow $*
I have no clue why it is not working with webstart and Linux...
A jar -tvf JRI.jar
gives me:
0 Sun Oct 07 12:28:14 CEST 2012 META-INF/
68 Sun Oct 07 12:28:14 CEST 2012 META-INF/MANIFEST.MF
0 Sun Oct 07 12:28:12 CEST 2012 org/
0 Sun Oct 07 12:28:12 CEST 2012 org/rosuda/
0 Sun Oct 07 12:28:12 CEST 2012 org/rosuda/JRI/
1079 Sun Oct 07 12:28:14 CEST 2012 org/rosuda/JRI/RVector.class
582 Sun Oct 07 12:28:14 CEST 2012 org/rosuda/JRI/RMainLoopCallbacks.class
2158 Sun Oct 07 12:28:14 CEST 2012 org/rosuda/JRI/RList.class
1723 Sun Oct 07 12:28:14 CEST 2012 org/rosuda/JRI/RFactor.class
10424 Sun Oct 07 12:28:14 CEST 2012 org/rosuda/JRI/Rengine.class
734 Sun Oct 07 12:28:14 CEST 2012 org/rosuda/JRI/RBool.class
1010 Sun Oct 07 12:28:14 CEST 2012 org/rosuda/JRI/RConsoleOutputStream.class
3082 Sun Oct 07 12:28:14 CEST 2012 org/rosuda/JRI/Mutex.class
9887 Sun Oct 07 12:28:14 CEST 2012 org/rosuda/JRI/REXP.class
190345 Sun Oct 07 12:28:12 CEST 2012 libjri.so
JaNeLA gives me
XML encoding not known, but declared as utf-8
'short' description is longer than 'default' description.
and for every resource jar I specified I got (example for persistence-api-1.0.jar):
Downloads can be optimized by specifying a resource size for 'persistence-api-1.0.jar'.
The resource download at persistence-api-1.0.jar can be optimized by removing the (default) value of download='eager'.
The resource download at persistence-api-1.0.jar can be optimized by removing the (default) value of main='false'.
It might be possible to optimize the start-up of the app. by specifying download='lazy' for the persistence-api-1.0.jar resource.
Lazy downloads might not work as expected for persistence-api-1.0.jar unless the download 'part' is specified.
All those notices are green or yellow.