From: Colin Bartlett Date: 2009-10-15T05:45:25+09:00 Subject: Re: how to solve a special JRuby and Java syntax conflict? Update to my previous post: following Paul Smith's suggestion to Axel Etzold, to "try posting your question to one of the resource available from http://jrubyhub.com" Axel did that and got a reply within 2.25 hours with Carl Leiby-2 giving the following elegant way of doing this: If I understand your problem correctly, you are in a bit of ruby code and want to define a 2 dimensional array of doubles to pass into a jmatharray function. You can just define the 2d array like you normally would in ruby: ruby_arr = [[0.25, 0.25, 0.25, 0.25], [0.25, 0.25, 0.25, 0.25], [0.25, 0.25, 0.25, 0.25], [0.25, 0.25, 0.25, 0.25]] Then to pass it into the jmatharray function you run to_java on it: ruby_arr.to_java Java::double[] I tested this in this bit of code: http://gist.github.com/210167 ** Translating Carl's post into the context of the ruby code in my previous post, the following also works, and is more elegant than my ways of dealing with the whole array: aa << [3.0, 3.1, 3.2] puts "* elegant way" acv.arr = aa.to_java Java::double[] acv.print_arr() puts acv.arr[1][2]