How to set classpath for rJava in R?

I have a package for R that contains several jar files. For better service, I want to break the banks in a separate package and have a source R and two small banks in the main package.
But now I always get "NoClassDefFoundError" from rJava if I call my functions.

In the main package, I have an onLoad function that starts the JVM using the .jpackage function.
According to this help, this function accepts the argument "morePaths", to which I have provided the absolute path to the two jar files. But that will not work.

I also tried using

jar.one = paste(lib,pkg,"java","One.jar",sep=.Platform$file.sep) jar.two = paste(lib,pkg,"java","Two.jar",sep=.Platform$file.sep) .jinit(classpath=c(jar.one,jar.two)) 

Inside the onLoad function.

Any hint would be appreciated,
Martin

+6
classpath r
source share
1 answer

Try .jaddClassPath

 .jaddClassPath("blah.jar") 
+5
source share

All Articles