Skip to content
Prev 13972 / 398502 Next

R and Java

On Tue, 2 Oct 2001, Andrew Schuh wrote:

            
It works (at least works better) when the .JavaInit() call specifies all
the classpaths you are going to use


The following snippet is from a demonstration that worked (even in front
of other people) under Windows. An earlier version with Unix path names
also worked under Debian, but I haven't tried that recently.


library(SJava)
##set up paths
orcaHomeDir<-"C:/Program Files/R/rw1030/library/orcaR/"
orcaHomeOrcaJar <- paste(orcaHomeDir,"exec/orca.jar",sep="")
orcaHomeVisADJar <- paste(orcaHomeDir,"exec/visad.jar",sep="")
orcaHomeGrappaJar <- paste(orcaHomeDir,"exec/grappalite.jar",sep="")
orcaHomeJaxpJar <- paste(orcaHomeDir,"exec/jaxp.jar",sep="")
orcaHomeParserJar <- paste(orcaHomeDir,"exec/parser.jar",sep="")
orcaClasses <- c(orcaHomeOrcaJar,orcaHomeVisADJar,
                 orcaHomeGrappaJar,orcaHomeJaxpJar,orcaHomeParserJar)
## Initialize JVM
.JavaInit(list(classPath=orcaClasses))
## Verify JVM
.Java("System", "getProperty", "java.class.path")


## Same example
TaoDataFile     <- paste(orcaHomeDir,"data/orca.tao.time",sep="")
TaoDataGroupVar  <- "Group"
TaoDataTimeVar <- "Time"

od.1 <- .Java("org.orca.data.parsers.OrcaDataSource",
              "openFileData",
              TaoDataFile,
              .name="od");



     -thomas

Thomas Lumley			Asst. Professor, Biostatistics
tlumley at u.washington.edu	University of Washington, Seattle

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._