title: Accessing data from Java object in rJava
body: <p>I have been trying to learn rJava to pass data back and forth between a set of Java applications I have programmed and R for analysis. I have a Java method with the signature</p>
  
  <pre><code>public double[][] method(void)
  </code></pre>
  
  <p>what I am going in R is as follows</p>
  
  <pre><code>library("rJava")
  .jinit(parameters="-Xmx10240m")
  s &lt;- .jarray("string", "mainArgs")
  javaobj &lt;- .jnew("JavaClass", s)
  data &lt;- .jcall(javaobj, "[[D", "method")
  </code></pre>
  
  <p>At this point I have data that is supposed to contain the matrix I need to use but I am not understanding how to turn data from a Java matrix to a rJava matrix</p>
  
  <blockquote>
    <p>data[1]</p>
  </blockquote>
  
  <p>returns</p>
  
  <pre><code>[[1]]
  [1] "Java-Array-Object[D:"
  </code></pre>
  
  <p>I have tried</p>
  
  <pre><code>as.list(data)
  as.list(data[1])
  as.list(data, simplify=TRUE)
  .jsimplify(trees)
  .jcastToArray(data)
  .jevalArray(data)
  .jevalArray(data, simplify=TRUE)
  </code></pre>
  
  <p>I am sure that what I am missing is obvious, but I just can't get it to work.</p>