Calling java Class from RPG using JNI
From: Roman Prigozhin (prigozhinroman_at_yahoo.com)
Date: 03/31/04
- Next message: Peter Ashford: "JSplitPane with AWT Canvas"
- Previous message: LeungPingCheung: "Re: Struts: Error Handling"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 30 Mar 2004 17:27:13 -0800
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
- Next message: Peter Ashford: "JSplitPane with AWT Canvas"
- Previous message: LeungPingCheung: "Re: Struts: Error Handling"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]