|
I'm trying to call my java methods from RPG, everything works but passing
string variables.
Probably I have some issues with data conversion.
Error I'm getting is :
Message . . . . : Java exception received when calling Java method (C G D
F).
Cause . . . . . : RPG procedure TEST in program ROMAN/TEST received Java
exception "java.lang.NoSuchMethodError: testStuff" when calling method
"testStuff" with signature "([B)I" in class "MyClass".
But prototype of the java function is correct :
Compiled from MyClass.java
public class MyClass extends java.lang.Object
public MyClass();
/* ()V */
public static int testStuff(byte[]);
/* ([B)I */
Here is my java class :
public class MyClass {
public static int testStuff( byte[] test ){
int size =0;
size = test.length;
return size;
}
}
Here is the Prototype :
D testStuff PR 10i 0 ExtProc(*JAVA:
D 'MyClass':
D 'testStuff')
D Static
D teststr 30A
And here is the RPG programm :
H DftActGrp(*NO) ActGrp(*CALLER)
/Copy *LibL/RPGSRC,TEST1PR
D first S 10i 0 Inz(23)
D second S 10i 0 Inz(18)
D sum S 10i 0
D testStr S 30A
/Free
// call my home grown method
testStr = 'roman';
sum = testStuff(testStr);
Dsply testStr;
/End-Free
Thanks,
Roman
www.aadt.com
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.