× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



I'm having some trouble calling a Java class that takes an int as one of
its inputs.  I have tried the following as the prototype for the method
parameter:

D  format                         O   Class(*JAVA:'java.lang.Integer')
D                                     Const

and this for the constructor:

D newInt          PR              O   ExtProc(*JAVA:
D                                             'java.lang.Integer':
D                                             *CONSTRUCTOR)
D                                     Class(*JAVA:'java.lang.Integer')
D  byes                       9999A   Const Varying

Here's the declaration for the field I'm using as the input parm for the
RPG program:

D xformat         S              5
 * I would think this should be 5I 0 or 5S 0, but it only compiles if I
declare this as alpha.

Here's the declaration for the variable I'm using as the input parm for the
Java class:

D sFormat         S               O   Class(*JAVA:'java.lang.Integer')

And finally, here's how I'm trying to create the java.lang.Integer object.

C                   Eval      sFormat   = newInt(xformat)

It compiles.  When I run it, here's the error I'm getting:

 Message ID . . . . . . :   RNQ0301
 Date sent  . . . . . . :   11/13/02      Time sent  . . . . . . :
20:39:50

 Message . . . . :   Java exception received when calling Java method (C G
D
   F).

 Cause . . . . . :   RPG procedure ICR001 in program ICR001/MIKEE received
Java
   exception "java.lang.NoSuchMethodError: <init>" when calling method
"<init>"
   with signature "([B)V" in class "java.lang.Integer".
 Recovery  . . . :   Contact the person responsible for program maintenance
to
   determine the cause of the problem.
 Possible choices for replying to message . . . . . . . . . . . . . . . :
   D -- Obtain RPG formatted dump.
   S -- Obtain system dump.
   G -- Continue processing at *GETIN.
   C -- Cancel.
   F -- Obtain full formatted dump.
 Technical description . . . . . . . . :   If the exception indicates that
the
   Java class was not found, ensure the class for the method is in the
class
   path. If the exception indicates that the Java method was not found,
check
   the method name and signature. If the signature is not correct, change
the
   RPG prototype for the method, or change the Java method, so that the
return
   type and parameter types match. You can determine the signatures for all
the
   methods in class XYZ using command QSH CMD('javap -s XYZ').


If it's not yet obvious, I really don't know what I'm doing here.  I'm
trying to adapt another RPG program we're using that calls a Java class,
but that one only uses strings.  I'd be happy to post all of the source on
request.

Thanks!

Mike E.






As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.