Forum: JRuby accessing fields from class

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
D0976c8374e3ea238aa7e104ae2605f8?d=identicon&s=25 Roderich T. (roderich)
on 2015-03-03 14:16
Hello,
what is the correct usage of field_accessor and field_reader?

I am calling a java class in my project, that is originally written in
Ruby and has been transferred using "jrubyc --javac myclass.rb". In
myclass.rb I use attr_accessor.

attr_accessor does obviously not work in a java class file. So it is
recommended to use field_accessor or field_reader instead. But the
result is an error "NameError: cannot initialize Java class". So what is
the correct way to make a field accessible in java classes?

Thanks Roderich
This topic is locked and can not be replied to.