Forum: JRuby Java arrays in jruby

B97f192e676f1a67e0ef18f022671406?d=identicon&s=25 Rodrigo Botafogo (Guest)
on 2012-07-06 18:31
(Received via mailing list)
Im trying to create and pass a java array to a java method.
According to the CallingJavaFromJRuby, one could just use the to_java
method to create the java array.  However, using to_java is not
creating a Java array but  If I
pass the proxy array to the java method that requires a java array,
the java method issues an exception:

         NameError: no method 'addGlobalAttribute' for arguments
(org.jruby.RubyString, on

Am I doing something wrong?


Rodrigo Botafogo
Integrando TI ao seu negcio
F1d37642fdaa1662ff46e4c65731e9ab?d=identicon&s=25 Charles Nutter (headius)
on 2012-07-08 01:10
(Received via mailing list)
The error message is unfortunately misleading here (and I'd appreciate a
bug report so we remember to fix it in 1.7 timeframe). You *are*
creating a Java array, but for Ruby to handle it like a Ruby object we
it in another object of type ArrayJavaProxy.

The error is probably caused by calling a method with the wrong type of
argument. How are you creating the Java array via to_java? (show code,

- Charlie
B97f192e676f1a67e0ef18f022671406?d=identicon&s=25 Rodrigo Botafogo (Guest)
on 2012-07-09 17:08
(Received via mailing list)
Hi Charles,

Thanks for your reply.  Ill file the bug report.  You are right.
Ive figured the problem out.  The method Im calling is expecting an
Array, but not a Java Array. It is the array type defined in the
library Im using.

Thanks for your help.


On Sun, Jul 8, 2012 at 12:09 AM, Charles Oliver Nutter
<> wrote:
>>          NameError: no method 'addGlobalAttribute' for arguments
>> Integrando TI ao seu negcio
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:

Rodrigo Botafogo
Integrando TI ao seu negcio
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.