JRUBY : 1.7.8 I am getting the classloader issue for jline. When I tired to debug with pry it load the jline class successfully , but without debug mode it just failed to load the class. Other related information: ----------------------------- I am using my project.jar which have included jruby-core-complete-1.7.8.jar and jruby-stdlib-complete-1.7.8.jar. I checked manually the jline package included in the jruby-stdlib-complete-1.7.8.jar, but the log says it looks from jruby-core-complete-1.7.8.jar , not sure. Please help. Log: ---------- [2014-05-20 10:42:34] ERROR Object: <NameError> cannot load Java class jline.console.ConsoleReader org/jruby/javasupport/JavaClass.java:1250:in `for_name' org/jruby/javasupport/JavaUtilities.java:34:in `get_proxy_class' file:/tmp/jruby882017107996340294extract/jruby-core-complete-1.7.8.jar!/jruby/java/core_ext/object.rb:26:in `java_import' org/jruby/RubyArray.java:2413:in `map' file:/tmp/jruby882017107996340294extract/jruby-core-complete-1.7.8.jar!/jruby/java/core_ext/object.rb:22:in `java_import' Thanks -Khirod
on 2014-05-20 09:36
on 2014-05-20 09:41
I just tried with set the CLASSPATH for jruby-complete-1.7.8.jar externaly, but still it is failing with same reason. 2014-05-20 13:09:07] ERROR Object: <NameError> cannot load Java class jline.console.ConsoleReader org/jruby/javasupport/JavaClass.java:1250:in `for_name' org/jruby/javasupport/JavaUtilities.java:34:in `get_proxy_class' file:/home/eip/installer/lib/jruby-complete-1.7.8.jar!/jruby/java/core_ext/object.rb:26:in `java_import' org/jruby/RubyArray.java:2413:in `map' file:/home/eip/installer/lib/jruby-complete-1.7.8.jar!/jruby/java/core_ext/object.rb:22:in `java_import' -khirod
on 2014-05-20 09:55
Now , I just extract the jline.jar from jruby-complete-1.7.8.jar and export in the CLASSPATH externally and it works fine. But I want to use the jline from jruby-complete-1.7.8.jar. Please help! -Khirod
on 2014-05-20 10:01

when I execute something like this: $ java -jar jruby-complete-1.7.8.jar -e 'p require"readline";p $CLASSPATH' things looks OK on my side. how do you execute jruby ? does it help if you require 'readline/jline-2.11' explicitly - something like $ java -jar jruby-complete-1.7.8.jar -e 'p require"readline/jline-2.11";p $CLASSPATH' ?
on 2014-05-20 13:36
Hi Christian, Thanks for your help. I tried your command it works fine in prompt. How can I used it my code? Do I have to use always pry , can't we load the class without pry.Please help. java -jar jruby-complete-1.7.8.jar -e 'p require "readline/jline-2.11";p $CLASSPATH' true Thanks -Khirod
on 2014-05-20 13:52

just add require 'readline/jline-2.11' before you want to use jline classes. let me know if that solves your problem so I can improve things on the jruby side of things.
on 2014-05-20 13:53
Hi Christian, In the code I tried p require "readline/jline-2.11" p $CLASSPATH It loaded successfully i.e. true ["file:/home/Khirod/myproject/lib/ojdbc6.jar", "file:/home/Khirod/myproject/lib/jruby-complete-1.7.8.jar", "file:/home/Khirod/myproject/lib/mycustom.jar", "jar:file:/tmp/jruby5839733601718663013extract/jruby-stdlib-complete-1.7.8.jar!/META-INF/jruby.home/lib/ruby/shared/readline/jline-2.11.jar"] I used the java_import to load ConsoleReader i.e. java_import 'jline.console.ConsoleReader' Here it is still failed to load the class jline.console.ConsoleReader. Thanks -Khirod
on 2014-05-20 14:13

I am sure this works for you as well: java -jar /usr/local/repository/org/jruby/jruby-complete/1.7.8/jruby-complete-1.7.8.jar t.rb -e "require 'readline';java_import 'jline.console.ConsoleReader'; p ConsoleReader.new" from your classpath above I see jruby-stdlib-complete-1.7.8.jar and jruby-complete-1.7.8.jar - there is something TOO much. jruby-complete is jruby-core-complete + jruby-stdlib-complete ! so when you are using jruby-complete please leave those other jars out of the classpath. hope that helps you a step further ;)
on 2014-05-20 18:02
Thanks Christian, The tricks works. Thanks for your suggestions. -Khirod