Thanks! That's exactly what I needed. Tim
Sent from my iPhone On Feb 15, 2011, at 1:32 AM, David Calavera <[email protected]> wrote: > Hi Tim, > > the problem is that the -J-cp option sets the classpath for the java process > rather than the jruby one. Last week I wrote a post about class loaders in > jruby that might help you: > > http://thinkincode.net/2011/02/09/jruby-class-loader-by-example.html > > Cheers > > > On Tue, Feb 15, 2011 at 7:51 AM, Tim Chen <[email protected]> wrote: > Hi all, > > I'm currently trying to use JRuby to launch our Java application, and I'm > currently just calling the command line jruby with all the dependencies > passed in as classpath and launching it in a Ruby script. > > ex: jruby -J-cp xxxxx/.jar:xxxxxx.jar run.rb > > The problem is that part of our app downloads yaml files and deserializes it > to objects based on the type specified in each field, and it calls > Class.forName('org.my.class') to > try to get the class and call its constructor. > > However, calling the java app from JRuby gives NoClassFound when calling > Class.forName, even though the class is in one of the jar files passed in the > classpath. > > I wonder what's the way to get the class loader to able to find that class? > > Thanks, > > Tim >
