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!