I defined a java class with several constructors with different parameters. If I try to create a java object in R via obj<-.jnew('testRJava/TestRJava', "Hello", "World")
or obj<-.jnew('testRJava/TestRJava', "Hello world")
everthing working as expected. But if I try to pass an Integer like obj<-.jnew('testRJava.TestRJava', "Hello", 123)
the following error is thrown:
Error in .jnew("testRJava/TestRJava", "Hello", 123) :
java.lang.NoSuchMethodError: <init>
On Java side I definitly defined the constructor public TestRJava(String param1, int param2) {...
and the rjava doc says:
Any parameters that will be passed to the corresponding constructor. The parameter types are determined automatically and/or taken from the jobjRef object. For details see .jcall. Note that all named parameters are discarded.
But I can't find how to pass an integer. Do I have to use .jcast
or anything else?
123 is a double. 123L is a (long) integer.