earlonrails
earlonrails

Reputation: 5182

How can I import all packages in jruby?

In java you can do something like this, to include all packages under java namespace.

import java.*;

At https://github.com/jruby/jruby/wiki/CallingJavaFromJRuby They suggest using include_package or import. I also tried java_package and java_import. Is there a way to import like this or do you just require the pacakges that you need.

Upvotes: 7

Views: 1404

Answers (1)

Sully
Sully

Reputation: 14943

require 'java'

module JavaUtil
  include_package "java.util"
end

JavaUtil::Date.new

Upvotes: 8

Related Questions