[R] rJava help

Duncan Murdoch murdoch at stats.uwo.ca
Thu Jan 4 05:10:46 CET 2007


I've just bought a couple of "iButton Thermochrons" (logging 
thermometers), and I'd like to access them through their Java interface 
from R.  But I've never really used Java, so I'm running into a problem, 
and I hope there's a very simple solution.

I've managed to use rJava to create an object with

 > provider <- .jnew("com/dalsemi/onewire/OneWireAccessProvider")
 > .jcall(provider,"Ljava/lang/Class;", "getClass")
[1] "Java-Object{class com.dalsemi.onewire.OneWireAccessProvider}"

and can see that it has a "getDefaultAdapter" method:

 > .jmethods(provider,"getDefaultAdapter")
[1] "public static com.dalsemi.onewire.adapter.DSPortAdapter 
com.dalsemi.onewire.OneWireAccessProvider.getDefaultAdapter() throws 
com.dalsemi.onewire.adapter.OneWireIOException,com.dalsemi.onewire.OneWireException"

but when I call that, I get an error:

 > adapter <- .jcall(provider, 
"Lcom/dalsemi/onewire/adapter/DSPortAdapter;", "getDefaultAdapter")
Error in .jcall(provider, "Lcom/dalsemi/onewire/adapter/DSPortAdapter;",  :
         RcallMethod: method not found

Is it obvious what I am doing wrong?

Duncan Murdoch



More information about the R-help mailing list