Cannot load Java class jline.console.ConsoleReader

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.


[2014-05-20 10:42:34] ERROR Object: cannot load Java class
org/jruby/javasupport/ for_name' org/jruby/javasupport/’
java_import' org/jruby/’


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: cannot load Java class
org/jruby/javasupport/ for_name' org/jruby/javasupport/’
java_import' org/jruby/’


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!


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


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.

when I execute something like this:

$ java -jar jruby-complete-1.7.8.jar -e ‘p require"readline";p

things looks OK on my side. how do you execute jruby ?

does it help if you require ‘readline/jline-2.11’ explicitly - something

$ java -jar jruby-complete-1.7.8.jar -e ‘p


Hi Christian,

In the code I tried

p require “readline/jline-2.11”

It loaded successfully i.e.



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.


I am sure this works for you as well:

java -jar
t.rb -e “require ‘readline’;java_import ‘jline.console.ConsoleReader’; p”

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
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 :wink:

Thanks Christian,

The tricks works. Thanks for your suggestions.