I use rJava to call a java code from R, trying to call an algorithm from SPMF tool. I tried to use a wrapper function as in this question, but this did not work with the SPMF code.
this is my R code:
library(rJava)
.jinit()
.jaddClassPath ( "C:/mydrive/eclipse-workspace/myfile/src")
print(.jclassPath())
obj <- .jnew("AlgoFPGrowth_Strings")
s <- .jcall(obj, returnSig= "V", method="runAlgorithm",
"input.csv","output.txt") , 0.4 )
it gives me error ,method runAlgorithm with signature (D)V not found
this is the main in java:
public static void main(String[] args) throws Exception {
AlgoFPGrowth_Strings fpwindow=new AlgoFPGrowth_Strings();
String input="input.csv";
String output="output.txt";
double minsupp = 0.4;
fpwindow.runAlgorithm( input, output, minsupp);
fpwindow.printStats();
}
I tried to change returnSig value into S and Ljava/lang/String; but I got the same error, could not find the method
when I apply the code on different java code with simple method it works, is there any idea how can I change my code?
Try the below methods,
Change your
jclassPath
, where you directly specify the complete pathname of your jar file including the jar name, say/home/user/mypath/myclass_name.jar
Or, you can unzip your jar file in a folder and refer to that path in your
jclassPath
.If, the above does not work,