Forum: JRuby NameError: cannot load Java class

67dd904963ce73ee90f5f6620a542aeb?d=identicon&s=25 Shrikrishna Khose (krishnaji)
on 2014-03-11 23:19
just started learning jRuby and tried to create a jar and use it but
getting  following error when I java_import 'packagename'

NameError: cannot load Java class

Could anyone  point me in right direction.

cat /Users/MacUser/jruby_projects/foo/bin/my_foo.rb

java_package ''
class Foo
   def bar(a, b)
     puts a + b

from foo folder I run
warble jar

then  foo/foo.jar
irb(main):001:0> require 'foo.jar'
=> true

irb(main):004:0> $CLASSPATH

irb(main):003:0> java_import ''
NameError: cannot load Java class
  from org/jruby/javasupport/ `for_name'
  from org/jruby/javasupport/ `get_proxy_class'
  from org/jruby/ `map'
  from (irb):3:in `evaluate'
  from org/jruby/ `eval'
  from org/jruby/ `loop'
  from org/jruby/ `catch'
  from org/jruby/ `catch'
  from /Users/MacUser/.rbenv/versions/jruby-1.7.11/bin/irb:13:in

Thank you for your time.
Caa2df9372ffa0a9e95b2bab1e8fea34?d=identicon&s=25 Karol Bucek (Guest)
on 2014-03-12 09:39
(Received via mailing list)
just read the error:

*NameError: cannot load Java class* is likely not in the package . treat java_import like
Java's import - import classes not packages.

for simple failures (esp. if you're getting started) may I advise to try

67dd904963ce73ee90f5f6620a542aeb?d=identicon&s=25 Shrikrishna Khose (krishnaji)
on 2014-03-15 12:25
Thank you !
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.