开发者

How to set the classpath for rJava in R?

开发者 https://www.devze.com 2023-01-04 07:23 出处:网络
I have a package for R which contains several jar files. For better maintenance I want to split the jars in a separate package and have the R source and two small jars in the main package.

I have a package for R which contains several jar files. For better maintenance I want to split the jars in a separate package and have the R source and two small jars in the main package.

But now I always get a "NoClassDefFoundError" from rJava, if I call my functions.

In the main package I have an onLoad function, which starts the JVM with the .jpackage function.

According to the help this function takes a "morePaths" argument, to which I provided the absolute path to the two jar files. But it won't work.

I also tried using

jar.one = paste(lib,pkg,"java","One.ja开发者_开发技巧r",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


Try .jaddClassPath

.jaddClassPath("blah.jar")
0

精彩评论

暂无评论...
验证码 换一张
取 消