From: steve.drach@... (Steve Drach) Date: 2004-06-20T02:48:18+09:00 Subject: Re: JRuby: How does one keep Java objects as Java objects so they can be used in method calls? > Well one way is to create a 'java_alias' ala: > >java_alias :JFile, :File > > then use 'JFile.new "/etc/blah"' Ok, I think I understand. It's because the constant File was already defined to be the org.jruby.RubyFile class. Is that correct? And java_alias just deals with Java constants? Is that why alias wouldn't work, since it would have aliased the RubyFile to JFile? It's all a little subtle for me. In any case, it seems to work, and both File and SAXBuilder are the correctly scoped type (symbol?) now. However it now fails mysteriously, not telling me which method is missing: jruby-0.7.0/bin/jruby.sh test.rb Foo::SAXBuilder Foo::JFile Exception in thread "main" java.lang.NoSuchMethodError at org.jruby.javasupport.JavaSupport.createRaiseException(JavaSupport.java:83) The new code is: require 'java' class Foo include_package 'java.io' include_package 'org.jdom' include_package 'org.jdom.input' java_alias :JFile, :File attr_reader :d def initialize sb = SAXBuilder.new p sb.class f = JFile.new "/home/drach/schema/modeler/build.xml" p f.class @d = sb.build f end end foo = Foo.new