On Tue, Sep 04, 2001 at 05:08:15PM +0100, Vasanthi, N (Nagalingam) wrote:
| Hi,
| I am testing my java applications using jython. I would like to know
| how a java method which returns an primitive array be used in jython
| eg) say my java method is
| public int[] read()
But this is in Java so it *must* be in some sort of class. This
signature doesn't include "static" so you need to have an instance of
the class to invoke the method on.
| I want to do something like this
| from jarray import array
This line isn't needed. You only need to use the jarray module if you
want to create a new array from jython code.
| arr = read() # I am not able to do this
This line tries to find an object named "read" first in the local scope of the
function it is in then in the scope of the module it is in, then
checks the builtins. There is no such object so the lookup fails. As
noted above, you need to create an instance of the java class so that
you can invoke the method on it.
HTH,
-D
|