From: Charles Oliver Nutter Date: 2008-08-02T07:18:34+09:00 Subject: Re: [jRuby] CLASSPATH problem ??? Une Bévue wrote: > begin > JavaLang::Class.forName("org.sqlite.JDBC").newInstance > [...] > rescue JavaLang::ClassNotFoundException > puts "ClassNotFoundException" > rescue JavaSql::SQLException > puts "SQLException" > end > > > i get allways "ClassNotFoundException" The problem here is the Class.forName call. Class.forName will try to use the system classloader if nothing else is specified. Since the system classloader doesn't allow pulling in new JAR files after startup, we have a separate sub-classloader for JRuby. If you want to load the class, just reference it directly or try to import it. require 'jdbc/sqlite3' org.sqlite.JDBC # or import 'org.sqlite.JDBC' This will use the JRuby classloader which knows about the loaded JAR file. I tried this, and it works fine for me here. ➔ jruby -e "require 'rubygems'; require 'jdbc/sqlite3'; p org.sqlite.JDBC" Java::OrgSqlite::JDBC - Charlie