Importing all classes in java package in jruby

import, java, jruby

Solution

require 'java'

module JavaUtil
  include_package "java.util"
end

JavaUtil::Date.new

Problem

I am looking for the syntax equiv to ``` import com.mycom.mypack.* ``` for jruby e.g. java_import com.mycom.mypack. This feature was added via JRUBY 6334 JIRA https://jira.codehaus.org/browse/JRUBY-6334 But it is not clear to me what is the actual syntax. Here is the comment by mr Jruby himself : ``` Charles Oliver Nutter added a comment - 17/Feb/12 1:13 PM commit a39a7440c21b411c4592a27d2ef9e0ca73736590 Author: Charles Oliver Nutter <headius@headius.com> Date: Fri Feb 17 13:06:24 2012 -0600 Fix JRUBY-6334: Import multiple classes via java_import I opted to just go with the simple version to resolve this issue. I have nothing against introducing some syntax to import multiple classes from the same package, but I didn't see anything that we all agreed looked nice, and in any case you could use other Ruby constructs to build the list of full names you pass to java_import. ```

Original source

Related problems