Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I import all packages in jruby?

Tags:

java

ruby

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.

like image 988
earlonrails Avatar asked Feb 05 '13 03:02

earlonrails


1 Answers

require 'java'

module JavaUtil
  include_package "java.util"
end

JavaUtil::Date.new
like image 160
Sully Avatar answered Nov 16 '22 07:11

Sully