http://java.sun.com/developer/technicalArticles/scripting/jruby/
http://www.headius.com/jrubywiki/index.php/Calling_Java_from_JRuby
After examining those writeups and doing a lot of experimenting,
I've been able to make 3rd party Java classes accessible by doing
the following:
1. Putting the JAR files in the CLASSPATH
(or $RUBY_HOME/lib)
AND 2. Requiring each jar individually
AND 3. Doing an include_class on each class I want to access,
using a fully qualified package name.
AND 4. Using the Java:: prefix when naming one of classes in
the code.
Comments:
* Doing steps 1, 3, and 4 didn't seem to work until I added step 2.
* I haven't tried steps 1 and 2 by themselves.
* I suspect that either step 3 or 4 is needed, but both are
not required. So if this method returns a Foo object:
x = Java::some.package.MyClass.staticGetMethod()
then:
include_class is probably /not/ necessary for MyClass
include_class probably /is/ necessary for Foo
Is that substantially correct, or are parts of it overkill?
--
Eric Armstrong, Document Systems Architect, Sun Microsystems
http://blogs.sun.com/coolstuff
http://www.artima.com/weblogs/index.jsp?blogger=cooltools
---------------------------------------------------------------------
To unsubscribe from this list please visit:
http://xircles.codehaus.org/manage_email