Skip to content

Using SJava?

2 messages · Benjamin.STABLER at odot.state.or.us, Roger Bivand

#
Hopefully, I'm not too late on this one....when you initialize the JVM you
need to set the class path as follows:

.JavaInit(config=javaConfig(classPath="StringDirectoryPathReference"))

or

.JavaInit(config=javaConfig(classPath=c("String1", "String2")))

for example:

.JavaInit(config=javaConfig(classPath="C:\javastuff"))

where javastuff contains my class files.  You need to specify the jar file
name if you are trying to include class files within jars.  I have used it
with some classes that I wrote.  

I too am excited about linking Java and R, as there is so much useful code
in the Java community.

Benjamin Stabler
Transportation Planning Analysis Unit
Oregon Department of Transportation
555 13th Street NE, Suite 2
Salem, OR 97301  Ph: 503-986-4104
#
On Mon, 5 Apr 2004 Benjamin.STABLER at odot.state.or.us wrote:

            
Yes, and Sys.putenv("CLASSPATH"="String1") can be used too, but what do 
you put in .Java() to get into your own jars? Are there escaping issues in 
the path to the jars? (backslash twice? forwardslash?) Could we put up 
some jars and some instructions for use on a website? Frank Hardisty sent 
me an example off-list that works from the command line but which I can't 
find from within R/SJava (Windows XP, the SJava examples that I've tried 
work for me). 

The idea would be to see if GeoTools2 can be reached from within R, 
because it could provide (another) way to import/export multiple GIS 
formats.

Roger