From simon.urbanek at r-project.org  Thu Jan 31 20:39:32 2008
From: simon.urbanek at r-project.org (Simon Urbanek)
Date: Thu, 31 Jan 2008 14:39:32 -0500
Subject: [Rd] Problem with R.2.6.1 and JRI - All worked file wih R2.5.1
In-Reply-To: <7cac4bd80801310837i188a9910padcd0e07ce4219e5@mail.gmail.com>
References: <7cac4bd80801310837i188a9910padcd0e07ce4219e5@mail.gmail.com>
Message-ID: <20DC9696-D003-4B23-A1E1-E9C48C5986B3@r-project.org>

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



[Rd] Problem with R.2.6.1 and JRI - All worked file wih R2.5.1
Simon Urbanek