Lieven Cardoen
Lieven Cardoen

Reputation: 25979

WEBrick jar library

Is there a default folder where WEBrick will search for jars when running JRuby on Rails in it? (something like the lib folder in Tomcat?)

Now I need to require all jars if running in WEBrick. In Tomcat I don't need to do this (I just need to put all my jars in the WEB-INF\lib folder).

Upvotes: 0

Views: 215

Answers (1)

kares
kares

Reputation: 7181

there's no such thing to my knowledge with WEBrick - it's basically the very same ruby code with JRuby as it is with MRI ... you seem to be ready for using Trinidad - it's similar to ruby servers such as WEBrick (startable from the CLI: cd myRailsApp; trinidad) but is actually a wrapped Tomcat.

put the jars into say myRailsApp/lib/java and run with trinidad --jars lib/java you can configure this with config/trinidad.yml so that you do not have to pass it every time.

I think it defaults to --lib lib thus putting jars directly into lib folder should work by default ...

as for the WEBrick, you can make an "auto-loaded" jar directory yourself, say you put your jars into myRailsApp/lib/java and then load them in an initializer, with something like :

Dir.glob("#{Rails.root}/lib/java/*.jar").each do |jar|
  require jar
end

Upvotes: 1

Related Questions