I am trying to execute a java method that receives an Integer array (I also tried with Byte array) and I get the following error:
IGZ0045S Unable to invoke method metodoIntA
In Cobol I have this coded:
01 DataIntArray object reference jintArray.
Call NewIntArray using
by value JNIEnvPtr
by value 5
returning DataIntArray
If DataIntArray not = null then
Display "NewObjectArray returned OKKKKK"
Else
Display "NewObjectArray returned null!"
Stop run
End-if
Invoke Hello "metodoIntA" using by value DataIntArray
Call NewIntArray using
by value JNIEnvPtr
by value 5
returning DataIntArray
If DataIntArray not = null then
Display "NewObjectArray returned OKKKKK"
Else
Display "NewObjectArray returned null!"
Stop run
End-if
Invoke Hello "metodoIntA" using by value DataIntArray
I have this in Java:
public static void metodoIntA(Integer[] name)
{
System.out.println("---metodoIntA--");
System.out.println("HELLO " + name);
}
{
System.out.println("---metodoIntA--");
System.out.println("HELLO " + name);
}
However, if I execute a method that receives a STRING or an Integer that is not an Array it works OK.
Cobol Code:
01 stringBuf pic X(32000) usage display.
01 jstring1 object reference JavaString.
Call "NewStringPlatform"
using by value JNIEnvPtr
address of stringBuf
address of jstring1
0
Invoke Hello "metodoString" using by value jstring1
01 jstring1 object reference JavaString.
Call "NewStringPlatform"
using by value JNIEnvPtr
address of stringBuf
address of jstring1
0
Invoke Hello "metodoString" using by value jstring1
Java Code:
public static void metodoString(String name)
{
System.out.println("---metodoString--");
System.out.println("Hello" + name);
}
{
System.out.println("---metodoString--");
System.out.println("Hello" + name);
}
How do I call a method that receives an array of objects or Integers?
My current cobol version is 4.2.
Thank you.