I get the following error messages some times when running JRuby scripts:
C:\Al\RobotWork\TestPlayer>jruby ScreenCapture.rb /jruby-0_9_2/src/builtin/javasupport.rb:359:in matching_method: no method 'read' with arguments matching [org.jruby.RubyFile] (NameError) from /jruby-0_9_2/src/builtin/javasupport.rb:113:in `setCacheDirectory' from /jruby-0_9_2/src/builtin/javasupport.rb:72:in `read' from ScreenCapture.rb:20:in `open_image_file' from ScreenCapture.rb:26
This always happens when I try to include the Java File class into my jruby scripts, like this:
I think what's happening is that my reference to a File object in my jruby code is ambiguous. The interpreter can't figure out whether I'm referring to the Java File class, or the Ruby File class.
What I do to get around this is explicitly reference the Java File class in my JRuby programs, something like this:
f = java.io.File.new("Foo.txt")
That's a pretty lame example, but hopefully you get the idea.