LS2J and dynamic arrays

Hi all,I’m having a problem passing a dynamic Byte array from LS to Java. Consider the following LS code :

Dim t2(2) As Byte

t2(0) = 0

t2(1) = 0

t2(2) = 0

Dim t3() As Byte

Redim t3(2)

t3(0) = 0

t3(1) = 0

t3(2) = 0

Call javaObj.setArr(t2)

Call javaObj.setArr(t3)

Java function :

public void setArr(byte arr)

{

[…]

}

The call with t2 works perfectly.

The call with t3 fails with the following LS2J error:

Parameter mismatch calling Java method. setArr

javaError.ErrorMsg and javaError.StackTrace are both empty.

I could not find any documentation that talks about dynamic arrays and LS2J. Anyone can share some experience with this ?

Alexis

Subject: LS2J and dynamic arrays

I have the same problem.Did you try treating your array in Java as a Vector?

then once in Java step through the objects of the Vector

to do as you need to

Java function :

public void setArr(Vector arr)

{

[…]

}

Subject: Re: LS2J and dynamic arrays

Hi Michael,

When I change byte to Vector in my Java function signature, both using a static and a dynamic Byte array in LS yields to the initial error message (Parameter mismatch calling Java method).

Subject: RE: Re: LS2J and dynamic arrays

Try the suggestion here ->dgg

Subject: RE: Re: LS2J and dynamic arrays

Dallas, that did the trick. Thanks a lot !