Forum: JRuby Re: [JRuby] - Unable to call java method from different directory

02ee2ff9234924331adcb4845754e75e?d=identicon&s=25 Muthu Selvan SR (Guest)
on 2013-06-28 00:47
(Received via mailing list)
Hi All ,

 I have moved the Java file into "Lib" director and tried to call that
java
from jruby ( separating java file in to separarte form Jruby code )  but
its giving below error


*// JRuby Code *
mselv2m1:ruby_Code mselv2$ cat Lib.rb
import '/Lib/Hi'
Java::Hi.SayHello()
#puts a
*// Java program in Lib folder *
mselv2m1:ruby_Code mselv2$ cd Lib
mselv2m1:Lib mselv2$ ls
Hi.java

*// ERROR :*
*
*
mselv2m1:ruby_Code mselv2$ jruby Lib.rb
NameError: cannot load Java class /Lib/Hi
         for_name at org/jruby/javasupport/JavaClass.java:1242
  get_proxy_class at org/jruby/javasupport/JavaUtilities.java:34
      java_import at
file:/usr/local/jruby-1.7.4/lib/jruby.jar!/jruby/java/core_ext/object.rb:26
              map at org/jruby/RubyArray.java:2417
      java_import at
file:/usr/local/jruby-1.7.4/lib/jruby.jar!/jruby/java/core_ext/object.rb:22
           (root) at Lib.rb:1
mselv2m1:ruby_Code mselv2$ pwd

Should i do any more modification when calling java from separate
directory

Thanks ,
Muthu Selvan SR
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.