Vladmir Makarov
2008-Jan-31 16:37 UTC
[Rd] Problem with R.2.6.1 and JRI - All worked file wih R2.5.1
Hello Members, I have posted this message at R-HELP listserv, so my apology for double posting, but members of R_HELP seem not to know/care about the problem. I wonder if someone also having a problem with JRI using new R 2.6.1. To illustrate the problem, there is a simple Java driver problem below. The program runs just fine on the other computer with R 2.5.1, but does not run with R 2.6.1. It gives me no error messages either. Needles to say, I have jri.dll at the classpath. Also, I have downloaded the rJava package from R program (packages >> install packages >> rJava), so version must be correct. Any suggestions are highly appreciated, Thanks, Vlad import org.rosuda.JRI.Rengine; public class Driver { public static void main(String[] args){ try { String[] arg = {}; Rengine re = new Rengine(arg, false, null); if (!Rengine.versionCheck()) { Rengine.getVersion(); System.err.println("** Version mismatch"); System.exit(1); } if (!re.waitForR()) { System.out.println("** Cannot load R"); System.exit(1); } double d = re.eval("3+5").asDouble(); System.out.print("D = " + d); } catch (RuntimeException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }
Simon Urbanek
2008-Jan-31 19:39 UTC
[Rd] Problem with R.2.6.1 and JRI - All worked file wih R2.5.1
Vladimir, your example works without problems in R 2.6.1: C:\Program Files\R\R-2.6.1\library\rJava\jri>javac -cp JRI.jar Driver.java C:\Program Files\R\R-2.6.1\library\rJava\jri>set PATH=C:\Program Files \R\R-2.6.1\bin;%PATH% C:\Program Files\R\R-2.6.1\library\rJava\jri>java -cp JRI.jar;. Driver D = 8.0 I suspect that you have some setting mismatch left over from your previous R version. Note that you may want to add System.exit(0) or terminate R, otherwise your application will be waiting for R to exit. Cheers, Simon On Jan 31, 2008, at 11:37 AM, Vladmir Makarov wrote:> Hello Members, > I have posted this message at R-HELP listserv, so my apology for > double posting, but members of R_HELP seem not to know/care about the > problem. > > I wonder if someone also having a problem with JRI using new R 2.6.1. > To illustrate the problem, there is a simple Java driver problem > below. The program runs just fine on the other computer with R 2.5.1, > but does not run with R 2.6.1. It gives me no error messages either. > Needles to say, I have jri.dll at the classpath. Also, I have > downloaded the rJava package from R program (packages >> install > packages >> rJava), so version must be correct. > > Any suggestions are highly appreciated, > Thanks, > Vlad > > > > import org.rosuda.JRI.Rengine; > > public class Driver { > > public static void main(String[] args){ > try { > String[] arg = {}; > Rengine re = new Rengine(arg, false, null); > if (!Rengine.versionCheck()) { > Rengine.getVersion(); > System.err.println("** Version mismatch"); > System.exit(1); > } > if (!re.waitForR()) { > System.out.println("** Cannot load R"); > System.exit(1); > } > double d = re.eval("3+5").asDouble(); > System.out.print("D = " + d); > } catch (RuntimeException e) { > // TODO Auto-generated catch block > e.printStackTrace(); > } > > } > > } > > ______________________________________________ > R-devel at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel > >