Hello List,
Today I am learning how to mix .java files with JRuby.
I want to jump a barrier which should be fairly low for most of you.
I have a file: MyClass.java
Here is what is in it:
public class MyClass {}
I compiled it with this shell command: javac MyClass.java
I have a Ruby file: include_myclass.rb
Here is what is in it:
#!/usr/bin/env jruby
include_myclass.rb
require ‘java’
include_class MyClass
class IncludeMyclass
def hello
p “hello”
end
end
IncludeMyclass.new.hello
I don’t understand why the
include_class MyClass
declaration gives me an error.
I am seeing this:
Fri Aug 06 19:24 /pt/b/jruby maco$
Fri Aug 06 19:24 /pt/b/jruby maco$ javac MyClass.java
Fri Aug 06 19:25 /pt/b/jruby maco$
Fri Aug 06 19:25 /pt/b/jruby maco$
Fri Aug 06 19:25 /pt/b/jruby maco$ jruby include_myclass.rb
include_myclass.rb:7: uninitialized constant MyClass (NameError)
Fri Aug 06 19:25 /pt/b/jruby maco$
Fri Aug 06 19:25 /pt/b/jruby maco$
Fri Aug 06 19:25 /pt/b/jruby maco$
How do I force
include_myclass.rb
to “see” MyClass.class ?
thanks
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email