If I develop a new rails application with both new ruby and
java files, where
is the ideal place for the java files and the resulting .jar
to be placed in
the rails directory structure?
I tend to put jar files into the lib directory - when warbled up, the
jar file will end up in WEB-INF/lib, and hence will be on the classpath.
Note that the app won’t run properly when it’s not war-ed up however,
unless you explicitely add them to the classpath or make a require call
in the ruby code.
This is the correct approach if what you have are java servlets or
context listeners that make calls to your ruby code. If what you have
are ruby libraries with compiled parts, then it’s probably best to have
the jar file elsewhere in the directory structure and explicitely
required from your code - that way there’ll be no difference between
using the code from script\console and script\server to when it’s run
from the war.
I’m not sure how the requiring of a jar file works if that jar is
already on the classpath - does anybody know if that’s a no-op, or does
it reload the classes within the ruby classloader?
To unsubscribe from this list, please visit: