Hi All,
JRuby list is quiet, so I was wondering if anyone here might be able to
help with the following question (below).
Thanks,
Nick
----------------------------------------------------------------------------------------------
Hi,
I was asking about the syntax of java package includes a while back and
gave this example:
require "java"
module Java
include_package "java.util"
end
v=Java::Vector.new
In wanting to not have to type Java:: for each class, I tried a Ruby
idiom I recently learned (I'm fairly new to it):
require "java"
module Java
include_package "java.util"
end
include Java
v=Vector.new
Which doesn't work. Is this a current limitation in Jruby? Does it have
something to do with the lazy-loading I heard mentioned before? Or am I
missing something. I figure if this worked, it would be 10 to 20 lines
of code or so to implement my own "import" method that works just like
Java or Jython syntax, and that would be cool.
On a related topic, I tried to use Class.forname("...") Java idiom to
load a JDBC driver (with the appropriate Module include_package and
prefixes), and it failed. Is there a known limitation here?
Final note- any advocacy tips/issues for recommending JRuby over Jython?
Thanks,
Nick