title: How to return Java Object of class into R (with rjava package)
body: <p>is there anyone, who is working with R and is using java code there? I mean calling Java code from R with "RJAVA" package.</p>
  
  <p>I create my own package and there I have jar file of java code. (like there <a href="https://cran.r-project.org/web/packages/helloJavaWorld/vignettes/helloJavaWorld.pdf" rel="nofollow noreferrer">https://cran.r-project.org/web/packages/helloJavaWorld/vignettes/helloJavaWorld.pdf</a>)</p>
  
  <p>Then I have .r file and I want to call java method.
  Problem is when I want to return "Java Object of class". There in no problem with "I" as integer or "S" as string. I need Java Object of class in R to continue working with it . It is possible? I found I can return Java Object with return value "L" (e.g."Ljava/lang/Object") but it doesn't work. </p>
  
  <p>This is my R code for calling java code:</p>
  
  <pre><code>FCA &lt;- function(){
  
      a &lt;- .jnew("fcamp/test/MainTest")  
      b &lt;- .jcall(a, "S", "testFunction")
      c &lt;- .jcall(a, "Lfcamp/input/Context;", "testFunction2")
  
      return(c) 
  }
  </code></pre>
  
  <p>This is my error:</p>
  
  <pre><code>Error in .jcall(a, "Lfcamp/input/Context;", "testFunction2") : 
  method testFunction2 with signature ()Lfcamp/input/Context; not found
  </code></pre>
  
  <p>Where is the mistake ? It is possible return Java Object of class to R and continue to work with it there?</p>