0

I have a java class I am using in my jruby project and in ruby I can set a value to an object via the send method. I am doing the same in jruby but using the java_send method instead. However, when I try using this I get the following error TypeError: can't convert Java::JavaIo::File into Array from org/jruby/java/proxies/JavaProxy.java:321:in 'java_send'

I have a java instance and I need to call the object via a symbol. Below is what I am doing in the code:

OUTPUT_FILES = [:make, :model]

javaArgs = javaArgs.new
OUTPUT_FILES.each do |filename|
   file = java.io.File.new(path, "#{filename.to_s.underscore}.csv")
   file.createNewFile
   javaArgs.java_send(filename, file)
end

and just to make sure when I do javaArgs.make = file it works without any problems.

1 Answer 1

1

java_send expects its arguments passed as an array: javaArgs.java_send filename, [ file ]

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.