Java_send for static methods

I am using JWNL for getting Wordnet to JRuby.
JWNL has a main class with a static method called “initialize”, which
clashes with Ruby’s initialize.

java_send or java_method (using JRuby 1.4) does not work,

undefined method `java_send’ for Java::NetDidionJwnl::JWNL:Class (NoMethodError)

neither does java_alias:

Jwnl = JavaUtilities.get_proxy_class(‘net.didion.jwnl.JWNL’)
class Jwnl; java_alias :jinitialize, :initialize; end

in `java_alias’: java method not found: net.didion.jwnl.JWNL.initialize()
(NameError)
(the static initialize is also 1-ary)

According to Java_method and java_send in master/1.4 - JRuby - Ruby-Forum, calling
static methods is not implemented:

This works for all instance methods. I have not implemented it for
static methods…does it seem like I should?

Is there any other way to calling a static method on a Java class?

Regards,
Jens

have you tried a newer version of jruby?
-r

I found that the error message changed, from

(1.4): undefined method `java_send’ for Java::NetDidionJwnl::JWNL:Class
(NoMethodError)

to

(1.6.1): NameError: Java method not found:
net.didion.jwnl.JWNL.initialize(java.io.FileInputStream)

So I made the call with the formal signature type (InputStream) instead
of the actual type (FileInputStream) which works:

f =
java.io.FileInputStream.new(’~/tools/jwnl/config/file_properties.xml’)
JWNL::Jwnl.java_send( :initialize, [java.io.InputStream], f )

Thanks for making me look again, Robert.

I am also trying JAWS (SWAJ, only backwards :wink: now, which still has
global initialization (via java.lang.System.setProperty), but doesn’t
need a separate XML-file for configuration.

Jens