Forum: JRuby NameError: cannot load Java class

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Db50a50169377dd825cd1f2ca03bca1e?d=identicon&s=25 Shrikrishna K. (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.
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

Db50a50169377dd825cd1f2ca03bca1e?d=identicon&s=25 Shrikrishna K. (krishnaji)
on 2014-03-15 12:25
Thank you !
This topic is locked and can not be replied to.