|
Yea, I have a CL that I prototype right into my source. I haven't done it that much either, so the same CL works for everything. Thanks, Mark Mark D. Walter Senior Programmer/Analyst CCX, Inc. mwalter@xxxxxxxxxx http://www.ccxinc.com "Shannon ODonnell" <sodonnell@irish- To studios.com> "'RPG programming on the AS400 / Sent by: iSeries'" <rpg400-l@xxxxxxxxxxxx> rpg400-l-bounces@ cc midrange.com Subject RE: Call Java Method from RPG 06/20/2005 02:00 PM Please respond to RPG programming on the AS400 / iSeries <rpg400-l@midrang e.com> I haven't spent a whole lot of time calling java methods from RPG. Just enough so that every time I need to do this, I have to stop and think for about half an hour about how I did it the last time. Anyway...because I am ALWAYS running into CLASSPATH problems (The CLASSPATH concept is my own personal Kryptonite) I now just add the classpath to the path as the very first step in my RPG program before I do anything else. Example: * Declare object refernce variable D obj_ref S O CLASS(*JAVA:'PFProJava4') D string S O CLASS(*JAVA:'java.lang.String') D bytes S O CLASS(*JAVA:'java.lang.String') * Prototype procedure to create java String object D newString PR O EXTPROC(*JAVA: D 'java.lang.String': D *CONSTRUCTOR) D CLASS(*JAVA:'java.lang.String') D charParm 1000A CONST VARYING * Prototype a GetBytes method D toBytes PR 1000a EXTPROC(*JAVA: D 'java.lang.string': D 'toBytes') VARYING * * Prototype procedure to instantiate 'PFProJava' class D PFProJava PR O D EXTPROC(*JAVA: D 'PFProJava4': D *CONSTRUCTOR) * Prototype procedure to accept the credit card info STRING Object D PFProAut PR 1000a D EXTPROC(*JAVA: D 'PFProJava4': D 'autCard') D stringParm LIKE(string) D Apost S 1a Inz('''') D CmdString S 1000a D Cmds PR ExtPgm('QCMDEXC') D command 1000A const D length 15P 5 const /Free CmdString = 'ADDENVVAR ENVVAR(CLASSPATH) VALUE(' + Apost + '/QIBM/ProdData/Java400/jsse1.0.3_02/lib/jcert.jar:' + '/QIBM/ProdData/Java400/jsse1.0.3_02/lib/jnet.jar:' + '/QIBM/ProdData/Java400/jsse1.0.3_02/lib/jsse.jar:' + '/QIBM/ProdData/Java400/verisign/payflowpro/java/Verisign.jar:' + '/QIBM/ProdData/Java400/verisign/payflowpro/java/' + Apost + ') REPLACE(*YES)'; Callp Cmds(CmdString:1000); // Convert alphanumeric string to java String object string = newString(Input_String); // Instantiate the 'PFProJava' class obj_ref = PFProJava(); // Call the 'main' method in class 'PFProJava' Response = PFProAut(obj_ref:string); HTH -----Original Message----- From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Scott Klement Sent: Monday, June 20, 2005 12:51 PM To: RPG programming on the AS400 / iSeries Subject: Re: Call Java Method from RPG Hi Mark, > This almost always speaks to a classpath issue. Where is the class > demo.MainCall located in the file system? That was my first instinct as well, but I can't see how the 'main' method would work if it were a classpath issue. -- This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/rpg400-l or email: RPG400-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/rpg400-l. -- This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/rpg400-l or email: RPG400-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/rpg400-l.
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.