1

I've been trying to develop R code that is using a function built in Java, but I'm having an error with .jcall.

The code built in Java can be found here: Getting incorrect Score using SentiWordNet

I've managed to create the .class and the .jar files. From the cmd window, I can check that my function returns an object of type double.

The code I'm running in R is the following:

.jinit(".")

.jaddClassPath("D:\\Users\\cristina.cerqueira\\Documents\\R\\win-library\\3.0\\SWN3\\SWN3.jar")
.jaddClassPath("C:\\Program Files\\Java\\jdk1.7.0_55\\lib\\SWN3.jar")
.jclassPath()


.jinit(".")
c <- .jnew("SWN3")

jSWR3 <-function(s) {

    result= .jcall("Ljava/lang/String", returnSig = "D", method=c, as.character(s),
            evalArray = TRUE, check = TRUE, evalString = TRUE,
            .jcast( rJava:::.rJava.class.loader,"java/lang/ClassLoader" ) )  

}

s <- c("love","v")
jSWR3(s)

The error is the following:

Error in .jcall("Ljava/lang/String", returnSig = "D", method = c, as.character(s),  : 
  RcallMethod: cannot determine object class

Any help is much appreciated!

Community
  • 1
  • 1
  • doesn't that big whitespace in your path give you troubles? also using `c` as both a function and an object name? – rawr Aug 04 '14 at 20:24
  • thanks for your comment! the whitespace was my bad copying the code into the question; i've replaced _method = c_ by _method = "SWN3"_ and the error continues to be the same – Cristina Cerqueira Aug 04 '14 at 20:29

0 Answers0