Date not working with jruby 1.6.1

New to jruby. Getting error on
require ‘date’

my code:
ScriptingContainer container = new ScriptingContainer();
container.setCompatVersion(CompatVersion.RUBY1_9);
container.runScriptlet(“require ‘date’”);

Yields:
LoadError: no such file to load – date
require at org/jruby/RubyKernel.java:1047
(root) at :1

I get the same error with ScriptEngine.

What should I be doing?
Thanks

Hello,

On Tue, May 24, 2011 at 2:27 PM, John J. [email protected]
wrote:

require at org/jruby/RubyKernel.java:1047
(root) at :1

I get the same error with ScriptEngine.

What should I be doing?
Thanks

You are using jruby.jar, not jruby-complete.jar right?
You need to tell ScriptingContainer/ScriptEngine where the JRuby’s
home is. This is to load date.rb from JRuby’s directory tree.

For ScriptingContainer, you can set the home directory by
setHomeDirectory(home) method of ScriptingContainer. As for JSR223,
you need to set jruby.home System property by commandline argument or
in your code.

Please see “Configuration” section of
https://github.com/jruby/jruby/wiki/RedBridge

-Yoko

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs