I have a java class (ClientService.java )where I have this in the main
method:
ScriptingContainer container = new ScriptingContainer(;
container.runScriptlet(“require ‘client’”);
container.runScriptlet(“Client.new.run”);
Client is a ruby file (client.rb) that looks like this:
require ‘singleton’
class Client
include Singleton
def run
puts “Client Running”
end
end
I compile everything in to a jar and run the jar using these commands:
jrubyc *.rb
javac -g *.java -cp jruby.jar
jar cvfm cs.jar conf/manifest.txt . -C lib .
java -jar cs.jar
After this I get the error:
lib/client.rb:1:in require': no such file to load -- singleton (LoadError) from lib/client.rb:1:in
require’
from :1
If I take out the Singleton it works fine.
I’m using rvm and have switched between jruby-1.4.0, jruby-1.5.0 and
jruby-1.5.1.
The 1.5.x gives me this error, 1.4 gives another error about linkage.