[R] Q: Best-Practice for Swing-GUI calling R-code on Windows?

ripley@stats.ox.ac.uk ripley at stats.ox.ac.uk
Mon Mar 3 08:55:04 CET 2003

On Mon, 3 Mar 2003, Till Baumgaertel wrote:

> org.omegahat.R.Java.REvaluator e = new
> 	org.omegahat.R.Java.REvaluator();
> 	Object val = e.eval("objects()");
> 	if(val != null) {
> 		String[] objects = (String[])val;
> 		for(int i = 0 ; i < objects.length; i++)
> 			System.err.println("("+i+") " + objects[i]);
> 	}
> hello,
> thanks to Philippe Grosjean's work I finally got SJava working (on Windows
> XP!!), so that I can call Java-Code from within R.

I don't think you have `got SJava working', as the error below is one
symptom of incomplete fixing of SJava.  (I am not sure what work of
Philippe Grosjean you are referring to, but I had to rewrite parts of the
Makefile.win as well as patch the R sources.  I sent the changes to 
Duncan TL back in November.)

There are patched sources and a compiled Windows binary version of SJava
for 1.6.2 at http://www.stats.ox.ac.uk/pub/bdr/SJava.  These were tested
pretty extensively last week, and the sources even work under R-devel
(1.7.0 to be).  They are prepared for a project I am involved with,
so there are no promises that they will stay available.  (There is even a 
binary for R-devel in the bin/windows/contrib/rw1070 area of CRAN.)

> Now I wanted to write a little Swing-GUI for entering some values and executing
> a R-call with them. The results should also be presented in the Java-layer.
> If possible, I'd like to see the R-console because I cat() some text what
> I like (but not need) to see.

Take a look at the installed examples in SJava (not all of which seem

> Now I'm wondering what's best practice for that? 
> Trying to call R from within Java I get an exception:
> java.lang.UnsatisfiedLinkError: eval
>         at org.omegahat.R.Java.REvaluator.eval(Native Method)
>         at org.omegahat.R.Java.REvaluator.eval(REvaluator.java:86)
>         at org.omegahat.R.Java.REvaluator.eval(REvaluator.java:36)
>         at SJavaTest.Main.main(Main.java:18)
> Exception in thread "main" 


Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

More information about the R-help mailing list