|
Hello;I just started trying calling Java from RPG. Found a very simple example from itjungle website.
(1) RPG code: H DftActGrp(*NO) ActGrp(*CALLER) D addStuff PR 10i 0 ExtProc(*JAVA: D 'MyClass': D 'addStuff') D Static D FirstInt 10i 0 Value D SecondInt 10i 0 Value D first S 10i 0 Inz(23) D second S 10i 0 Inz(18) D sum S 10i 0 /Free sum = addStuff(first:second); Dsply sum; *InLr = *On; /End-Free (2) Java code: public class MyClass { public static int addStuff(int first, int second) { return first + second; } public static void main(String[] args) { System.out.println("start..."); System.out.println(addStuff(11, 22)); } } (3) Set CLASSPATH by using ==> ADDENVVAR ENVVAR(CLASSPATH) VALUE('/home') (4) Run MyClass by using ==> JAVA CLASS(MyClass) It worked! This showed that CLASSPATH was set correctly. (5) Run RPG program and I got this error: Java exception received when calling Java method (C G D F) Cause . . . . . : RPG procedure CALLJAVA3 in program PRODLIB/CALLJAVA3 received Java exception "java.lang.NoClassDefFoundError: MyClass" when calling method "addStuff" with signature "(II)I" in class "MyClass". Help! _________________________________________________________________Express yourself instantly with MSN Messenger! Download today - it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 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.