Discussion:
[jruby-user] Re: cannot load Java class jline.console.ConsoleReader
Khirod Patra
2014-05-20 07:41:45 UTC
Permalink
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
--
Posted via http://www.ruby-forum.com/.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email
Khirod Patra
2014-05-20 07:55:18 UTC
Permalink
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
--
Posted via http://www.ruby-forum.com/.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email
christian
2014-05-20 08:00:15 UTC
Permalink
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'

?
Khirod Patra
2014-05-20 07:36:13 UTC
Permalink
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
--
Posted via http://www.ruby-forum.com/.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email
Khirod Patra
2014-05-20 11:36:19 UTC
Permalink
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
--
Posted via http://www.ruby-forum.com/.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email
christian
2014-05-20 11:50:54 UTC
Permalink
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.
Post by Khirod Patra
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
--
Posted via http://www.ruby-forum.com/.
---------------------------------------------------------------------
http://xircles.codehaus.org/manage_email
Khirod Patra
2014-05-20 11:53:23 UTC
Permalink
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
--
Posted via http://www.ruby-forum.com/.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email
christian
2014-05-20 12:10:20 UTC
Permalink
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 ;)
Post by Khirod Patra
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
--
Posted via http://www.ruby-forum.com/.
---------------------------------------------------------------------
http://xircles.codehaus.org/manage_email
Khirod Patra
2014-05-20 16:02:36 UTC
Permalink
Thanks Christian,

The tricks works. Thanks for your suggestions.

-Khirod
--
Posted via http://www.ruby-forum.com/.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email
Loading...