I am trying to call a method in java class with rJava for a few days and I did not yet figure it out what I am doing wrong. Maybe someone here will have a some clues for me.
The situation looks like this:
I load library and initializing an object (that's works fine):
library(rJava) .jinit('C:/javatemp/worker.jar') jobject <- .jnew("worker.concrete")
I list methods and I get fine result:
.jmethods(jobject) > [1] "public java.util.List worker.concrete.lookup(java.lang.CharSequence)"
I am preparing input structure which also works fine:
word <- .jnew("java/lang/String", "a word") input = .jcast(word, "java/lang/CharSequence", check = TRUE)
However when I am trying to execute the method I get an error that such method does not exist...
out = .jcall(jobject,"Ljava/util/List","lookup",input) > Error in .jcall(jobject, "Ljava/util/List", "lookup", input) : method lookup with signature (Ljava/lang/CharSequence;)Ljava/util/List not found
Does anyone have an idea how to call such method?
Sorry for answering an old question, but this has bugged me as well for some time. The answer is:
;
The format of type specification for non-primitive return types is
Lpackage/subpackage/Type;
- it has to end with a semicolon. So in the example above, you would need: